13 #ifndef IMPKINEMATICS_REVOLUTE_JOINTS_H
14 #define IMPKINEMATICS_REVOLUTE_JOINTS_H
16 #include "kinematics_config.h"
21 #include <IMP/core/internal/dihedral_helpers.h>
26 #define IMP_RAD_2_DEG(a) 180 * a / IMP::algebra::PI
27 #define IMP_DEG_2_RAD(a) a* IMP::algebra::PI / 180
29 IMPKINEMATICS_BEGIN_NAMESPACE
31 class KinematicForest;
67 void set_angle(
double angle);
73 double get_angle()
const;
79 return rot_axis_origin_;
84 return rot_axis_unit_vector_;
105 virtual void update_axis_of_rotation_from_cartesian_witnesses() = 0;
115 virtual double get_current_angle_from_cartesian_witnesses()
const = 0;
122 update_axis_of_rotation_from_cartesian_witnesses();
123 angle_ = get_current_angle_from_cartesian_witnesses();
124 last_updated_angle_ = angle_;
136 IMP_LOG(
VERBOSE,
"get_rotation " << IMP_RAD_2_DEG(angle_)
137 <<
", last_updated_angle = "
138 << IMP_RAD_2_DEG(last_updated_angle_)
143 rot_axis_unit_vector_, angle_ - last_updated_angle_);
160 mutable double last_updated_angle_;
207 using namespace IMP::algebra;
209 get_distance(b_.get_coordinates(), c_.get_coordinates()) > 1e-12,
210 "witnesses b and c must be non identical beyond numerical error");
214 IMP_LOG(
VERBOSE,
"global b_ " << b_.get_coordinates()
215 <<
" and local parent b_ " << rot_axis_origin_
217 Vector3D v = rf_parent.get_local_coordinates(c_.get_coordinates()) -
218 rf_parent.get_local_coordinates(b_.get_coordinates());
219 rot_axis_unit_vector_ = v.get_unit_vector();
220 IMP_LOG(
VERBOSE,
"local axis of rot unnorm "
221 << v <<
" global axis "
222 << c_.get_coordinates() - b_.get_coordinates()
282 using namespace IMP::algebra;
285 get_distance(b_.get_coordinates(), c_.get_coordinates()) > 1e-12,
286 "witnesses b and c must be non identical beyond numerical error");
288 get_distance(b_.get_coordinates(), a_.get_coordinates()) > 1e-12,
289 "witnesses b and a must be non identical beyond numerical error");
293 rot_axis_unit_vector_ = v.get_unit_vector();
294 rot_axis_origin_ = rf_parent.get_local_coordinates(b_.get_coordinates());
314 IMPKINEMATICS_END_NAMESPACE
Rotation3D get_rotation_about_normalized_axis(const Vector3D &axis_norm, double angle)
Exception definitions and assertions.
virtual void update_joint_from_cartesian_witnesses()
virtual void update_axis_of_rotation_from_cartesian_witnesses()
Transformation2D get_rotation_about_point(const Vector2D &point, const Rotation2D &rotation)
Generates a Transformation2D object from a rotation around a point.
Vector3D get_local_coordinates(const Vector3D &v) const
double get_distance(const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D.
Vector3D get_vector_product(const Vector3D &p1, const Vector3D &p2)
Returns the vector product (cross product) of two vectors.
functionality for defining a kinematic joint between rigid bodies as part of a kinematic tree ...
IMP::algebra::Transformation3D get_rotation_about_joint_in_parent_coordinates() const
virtual void update_joint_from_cartesian_witnesses()
functionality for defining nodes on a kinematic chain
A decorator for a particle with x,y,z coordinates.
virtual void update_axis_of_rotation_from_cartesian_witnesses()
const algebra::Vector3D & get_coordinates() const
Convert it to a vector.
virtual double get_current_angle_from_cartesian_witnesses() const =0
virtual void update_child_node_reference_frame() const
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Exception definitions and assertions.
A shared base class to help in debugging and things.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
A decorator for a rigid body.