13 #ifndef IMPKINEMATICS_REVOLUTE_JOINTS_H
14 #define IMPKINEMATICS_REVOLUTE_JOINTS_H
16 #include "kinematics_config.h"
22 #include <IMP/core/internal/dihedral_helpers.h>
27 #define IMP_RAD_2_DEG(a) 180 * a / IMP::algebra::PI
28 #define IMP_DEG_2_RAD(a) a* IMP::algebra::PI / 180
30 IMPKINEMATICS_BEGIN_NAMESPACE
32 class KinematicForest;
68 void set_angle(
double angle);
74 double get_angle()
const;
80 return rot_axis_origin_;
85 return rot_axis_unit_vector_;
106 virtual void update_axis_of_rotation_from_cartesian_witnesses() = 0;
116 virtual double get_current_angle_from_cartesian_witnesses()
const = 0;
123 update_axis_of_rotation_from_cartesian_witnesses();
124 angle_ = get_current_angle_from_cartesian_witnesses();
125 last_updated_angle_ = angle_;
137 IMP_LOG(
VERBOSE,
"get_rotation " << IMP_RAD_2_DEG(angle_)
138 <<
", last_updated_angle = "
139 << IMP_RAD_2_DEG(last_updated_angle_)
144 rot_axis_unit_vector_, angle_ - last_updated_angle_);
161 mutable double last_updated_angle_;
203 using namespace IMP::algebra;
205 get_distance(b_.get_coordinates(), c_.get_coordinates()) > 1e-12,
206 "witnesses b and c must be non identical beyone numerical error");
210 IMP_LOG(
VERBOSE,
"global b_ " << b_.get_coordinates()
211 <<
" and local parent b_ " << rot_axis_origin_
213 Vector3D v = rf_parent.get_local_coordinates(c_.get_coordinates()) -
214 rf_parent.get_local_coordinates(b_.get_coordinates());
215 rot_axis_unit_vector_ = v.get_unit_vector();
216 IMP_LOG(
VERBOSE,
"local axis of rot unnorm "
217 << v <<
" global axis "
218 << c_.get_coordinates() - b_.get_coordinates()
278 using namespace IMP::algebra;
281 get_distance(b_.get_coordinates(), c_.get_coordinates()) > 1e-12,
282 "witnesses b and c must be non identical beyond numerical error");
284 get_distance(b_.get_coordinates(), a_.get_coordinates()) > 1e-12,
285 "witnesses b and a must be non identical beyond numerical error");
289 rot_axis_unit_vector_ = v.get_unit_vector();
290 rot_axis_origin_ = rf_parent.get_local_coordinates(b_.get_coordinates());
310 IMPKINEMATICS_END_NAMESPACE
Rotation3D get_rotation_about_normalized_axis(const Vector3D &axis_norm, double angle)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
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.
Exception definitions and assertions.
A shared base class to help in debugging and things.
A decorator for a rigid body.