IMP  2.1.1
The Integrative Modeling Platform
Joint.h
Go to the documentation of this file.
1 /**
2  \file 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-2013 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
34 : public IMP::base::Object
35 {
36  friend class KinematicForest;
37  friend class CompositeJoint;
38 
40 
41 public:
42  /**
43  An abstract class for a joint between a parent and a child
44 
45  @param parent rigid body upstream of this joint
46  @param child rigid body downstream of this joint
47  @note we currently assume that a parent cannot be switched
48  */
50 
51  /***************** getter methods: ***************/
52 
53  public:
54 
55  KinematicForest* get_owner_kf() const{
56  return owner_kf_;
57  }
58 
59  /**
60  returns the transformation of a vector from the child
61  reference frame to the parent reference frame in a safe way
62  (= after updating internal coordinates if needed)
63  */
64  // hack to make it compile on swig - this should be fixed as it might
65  // cause some pathologies
66 IMP_NO_SWIG(virtual)
67  const IMP::algebra::Transformation3D&
68  get_transformation_child_to_parent() const;
69 
70  IMP::core::RigidBody get_parent_node() const
71  { return parent_; }
72 
73  IMP::core::RigidBody get_child_node() const
74  { return child_; }
75 
76 
77  protected:
78 
79  /**
80  returns the transformation of a vector from the child
81  reference frame to the parent reference frame, without any checks
82  (= without updating internal coordinates even if needed)
83  */
84  // hack to make it compile on swig - this should be fixed as it might
85  // cause some pathologies
86  IMP_NO_SWIG(virtual)
87  const IMP::algebra::Transformation3D&
88  get_transformation_child_to_parent_no_checks() const {
89  return tr_child_to_parent_;
90  }
91 
92 
93  /***************** setter methods: ***************/
94 
95  protected:
96 
97  /** this sets the kinematic forest that manages this joint,
98  and also declares it as used (\see Object::set_was_used()
99  */
101  owner_kf_ = kf;
102  Object::set_was_used(true);
103  }
104 
105  /**
106  Sets the transfromation from parent to child reference frame
107  (without any checks that internal coords are updated, and without
108  marking the owner internal coords as changed)
109  */
110  void set_transformation_child_to_parent_no_checks
112  tr_child_to_parent_ = transformation;
113  }
114 
115 
116  /**************** general methods: **************/
117 
118  /**
119  Updates the reference frame of the rigid body directly downstream
120  of this joint
121  */
122  virtual void
123  update_child_node_reference_frame() const;
124 
125 
126 
127  /**
128  Updates the joint transformation based on external coordinates
129  of 'witness' particles.
130 
131  @note It is assumed that external coordinates are updated before
132  calling this function.
133  @note Witness particles do not necessarily belong to the child or
134  parent rigid bodes.
135  */
136  virtual void update_joint_from_cartesian_witnesses();
137 
138 private:
139  IMP::core::RigidBody parent_;
140  IMP::core::RigidBody child_;
141  IMP::algebra::Transformation3D tr_child_to_parent_;
142  KinematicForest* owner_kf_; // the tree that manages updates to this joint
143 };
144 
146 
147 IMPKINEMATICS_END_NAMESPACE
148 
149 #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.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Exception definitions and assertions.
void set_owner_kf(KinematicForest *kf)
Definition: Joint.h:100
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