13 #ifndef IMPKINEMATICS_REVOLUTE_JOINTS_H
14 #define IMPKINEMATICS_REVOLUTE_JOINTS_H
16 #include <IMP/kinematics/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;
65 void set_angle(
double angle);
77 return rot_axis_origin_;
82 return rot_axis_unit_vector_;
103 virtual void update_axis_of_rotation_from_cartesian_witnesses() = 0;
113 virtual double get_current_angle_from_cartesian_witnesses()
const = 0;
120 update_axis_of_rotation_from_cartesian_witnesses();
121 angle_ = get_current_angle_from_cartesian_witnesses();
122 last_updated_angle_ = angle_;
134 IMP_LOG(
VERBOSE,
"get_rotation " << IMP_RAD_2_DEG(angle_)
135 <<
", last_updated_angle = "
136 << IMP_RAD_2_DEG(last_updated_angle_)
141 rot_axis_unit_vector_, angle_ - last_updated_angle_);
158 mutable double last_updated_angle_;
204 using namespace IMP::algebra;
206 get_distance(b_.get_coordinates(), c_.get_coordinates()) > 1e-12,
207 "witnesses b and c must be non identical beyond numerical error");
211 IMP_LOG(
VERBOSE,
"global b_ " << b_.get_coordinates()
212 <<
" and local parent b_ " << rot_axis_origin_
214 Vector3D v = rf_parent.get_local_coordinates(c_.get_coordinates()) -
215 rf_parent.get_local_coordinates(b_.get_coordinates());
216 rot_axis_unit_vector_ = v.get_unit_vector();
217 IMP_LOG(
VERBOSE,
"local axis of rot unnorm "
218 << v <<
" global axis "
219 << c_.get_coordinates() - b_.get_coordinates()
279 using namespace IMP::algebra;
282 get_distance(b_.get_coordinates(), c_.get_coordinates()) > 1e-12,
283 "witnesses b and c must be non identical beyond numerical error");
285 get_distance(b_.get_coordinates(), a_.get_coordinates()) > 1e-12,
286 "witnesses b and a must be non identical beyond numerical error");
289 rf_parent.get_local_coordinates(get_perpendicular_vector(a_, b_, c_));
290 rot_axis_unit_vector_ = v.get_unit_vector();
291 rot_axis_origin_ = rf_parent.get_local_coordinates(b_.get_coordinates());
311 IMPKINEMATICS_END_NAMESPACE
Rotation3D get_rotation_about_normalized_axis(const Vector3D &axis_norm, double angle)
Abstract class for all revolute joints.
Joint that is parameterized as a bond angle between three particles.
Exception definitions and assertions.
double get_angle(const Line3D &a, const Line3D &b)
Get angle in radians between two lines around their closest points.
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)
Generate a Transformation2D object from a rotation around a point.
Vector3D get_local_coordinates(const Vector3D &v) const
Vector3D get_vector_product(const Vector3D &p1, const Vector3D &p2)
Return 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()
Produce copious output to allow someone to trace through the computation.
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
Joint that is parameterized as a dihedral angle between two planes.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Helper macros for throwing and handling exceptions.
Base class for joints between rigid bodies in a kinematic tree.
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.
double get_distance(const Line3D &s, const Vector3D &p)
Get closest distance between a line and a point.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.