IMP  2.2.0
The Integrative Modeling Platform
Joint.h
Go to the documentation of this file.
1 /**
2  \file IMP/kinematics/Joint.h
3  \brief functionality for defining a kinematic joint between rigid bodies
4  as part of a kinematic tree
5 
6  \authors Dina Schneidman, Barak Raveh
7 
8  Copyright 2007-2014 IMP Inventors. All rights reserved.
9 */
10 
11 #ifndef IMPKINEMATICS_JOINT_H
12 #define IMPKINEMATICS_JOINT_H
13 
14 #include <IMP/kinematics/kinematics_config.h>
16 #include <IMP/base/Object.h>
17 //#include <IMP/nullptr.h>
18 #include <IMP/base/exception.h>
19 #include <IMP/core/internal/dihedral_helpers.h>
20 #include <IMP/algebra/Vector3D.h>
21 #include <IMP/base/check_macros.h>
22 #include <IMP/base/swig_macros.h>
23 
24 IMPKINEMATICS_BEGIN_NAMESPACE
25 
26 class KinematicForest;
27 
28 // TODO: make abstract?
29 /**
30  Base class for joints between rigid bodies in a kinematic
31  tree.
32 */
33 class IMPKINEMATICSEXPORT Joint : public IMP::base::Object {
34  friend class KinematicForest;
35  friend class CompositeJoint;
36 
38 
39  public:
40  /**
41  An abstract class for a joint between a parent and a child
42 
43  @param parent rigid body upstream of this joint
44  @param child rigid body downstream of this joint
45  @note we currently assume that a parent cannot be switched
46  */
48 
49  /***************** getter methods: ***************/
50 
51  public:
52  KinematicForest* get_owner_kf() const { return owner_kf_; }
53 
54  /**
55  returns the transformation of a vector from the child
56  reference frame to the parent reference frame in a safe way
57  (= after updating internal coordinates if needed)
58  */
59  // hack to make it compile on swig - this should be fixed as it might
60  // cause some pathologies
61  IMP_NO_SWIG(virtual)
62  const IMP::algebra::Transformation3D& get_transformation_child_to_parent()
63  const;
64 
65  IMP::core::RigidBody get_parent_node() const { return parent_; }
66 
67  IMP::core::RigidBody get_child_node() const { return child_; }
68 
69  protected:
70  /**
71  returns the transformation of a vector from the child
72  reference frame to the parent reference frame, without any checks
73  (= without updating internal coordinates even if needed)
74  */
75  // hack to make it compile on swig - this should be fixed as it might
76  // cause some pathologies
77  IMP_NO_SWIG(virtual)
78  const IMP::algebra::Transformation3D&
79  get_transformation_child_to_parent_no_checks() const {
80  return tr_child_to_parent_;
81  }
82 
83  /***************** setter methods: ***************/
84 
85  protected:
86  /** this sets the kinematic forest that manages this joint,
87  and also declares it as used (\see Object::set_was_used()
88  */
90  owner_kf_ = kf;
92  }
93 
94  /**
95  Sets the transfromation from parent to child reference frame
96  (without any checks that internal coords are updated, and without
97  marking the owner internal coords as changed)
98  */
100  IMP::algebra::Transformation3D transformation) {
101  tr_child_to_parent_ = transformation;
102  }
103 
104  /**************** general methods: **************/
105 
106  /**
107  Updates the reference frame of the rigid body directly downstream
108  of this joint
109  */
110  virtual void update_child_node_reference_frame() const;
111 
112  /**
113  Updates the joint transformation based on external coordinates
114  of 'witness' particles.
115 
116  @note It is assumed that external coordinates are updated before
117  calling this function.
118  @note Witness particles do not necessarily belong to the child or
119  parent rigid bodes.
120  */
121  virtual void update_joint_from_cartesian_witnesses();
122 
123  private:
124  IMP::core::RigidBody parent_;
125  IMP::core::RigidBody child_;
126  IMP::algebra::Transformation3D tr_child_to_parent_;
127  KinematicForest* owner_kf_; // the tree that manages updates to this joint
128 };
129 
131 
132 IMPKINEMATICS_END_NAMESPACE
133 
134 #endif /* IMPKINEMATICS_JOINT_H */
Simple 3D transformation class.
void set_was_used(bool tf) const
Various general useful macros for IMP.
#define IMP_NO_SWIG(x)
Hide the line when SWIG is compiled or parses it.
functionality for defining nodes on a kinematic chain
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Common base class for heavy weight IMP objects.
Definition: base/Object.h:106
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Exception definitions and assertions.
void set_transformation_child_to_parent_no_checks(IMP::algebra::Transformation3D transformation)
Definition: Joint.h:99
void set_owner_kf(KinematicForest *kf)
Definition: Joint.h:89
Simple 3D vector class.
Exception definitions and assertions.
A shared base class to help in debugging and things.
A decorator for a rigid body.
Definition: rigid_bodies.h:75