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;
75 void set_angle(
double angle);
81 double get_angle()
const;
87 {
return rot_axis_origin_; }
91 {
return rot_axis_unit_vector_; }
111 virtual void update_axis_of_rotation_from_cartesian_witnesses() = 0;
121 virtual double get_current_angle_from_cartesian_witnesses()
const = 0;
129 update_axis_of_rotation_from_cartesian_witnesses();
130 angle_ = get_current_angle_from_cartesian_witnesses();
131 last_updated_angle_ = angle_;
144 IMP_LOG(
VERBOSE,
"get_rotation " << IMP_RAD_2_DEG(angle_)
145 <<
", last_updated_angle = "
146 << IMP_RAD_2_DEG(last_updated_angle_) << std::endl );
150 ( rot_axis_unit_vector_, angle_ - last_updated_angle_ );
168 mutable double last_updated_angle_;
184 class IMPKINEMATICSEXPORT
212 using namespace IMP::algebra;
214 (
get_distance( b_.get_coordinates(), c_.get_coordinates() )
216 "witnesses b and c must be non identical beyone numerical error" );
220 IMP_LOG(
VERBOSE,
"global b_ " << b_.get_coordinates()
221 <<
" and local parent b_ " << rot_axis_origin_ << std::endl);
223 rf_parent.get_local_coordinates( c_.get_coordinates() )
224 - rf_parent.get_local_coordinates( b_.get_coordinates() );
226 IMP_LOG(
VERBOSE,
"local axis of rot unnorm " << v
227 <<
" global axis " << c_.get_coordinates() - b_.get_coordinates()
280 virtual double get_current_angle_from_cartesian_witnesses()
const;
289 using namespace IMP::algebra;
292 (
get_distance( b_.get_coordinates(), c_.get_coordinates() )
294 "witnesses b and c must be non identical beyond numerical error" );
296 (
get_distance( b_.get_coordinates(), a_.get_coordinates() )
298 "witnesses b and a must be non identical beyond numerical error" );
300 Vector3D v = rf_parent.get_local_coordinates
301 ( get_perpendicular_vector(a_, b_, c_) );
303 rot_axis_origin_ = rf_parent.get_local_coordinates
304 ( b_.get_coordinates() );
329 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.
VectorD get_unit_vector() const
Exception definitions and assertions.
A shared base class to help in debugging and things.
A decorator for a rigid body.