IMP logo
IMP Reference Guide  2.20.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-2022 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/Object.h>
17 #include <IMP/exception.h>
18 #include <IMP/core/internal/dihedral_helpers.h>
19 #include <IMP/algebra/Vector3D.h>
20 #include <IMP/check_macros.h>
21 #include <IMP/swig_macros.h>
22 
23 IMPKINEMATICS_BEGIN_NAMESPACE
24 
25 class KinematicForest;
26 
27 // TODO: make abstract?
28 //! Base class for joints between rigid bodies in a kinematic tree.
29 class IMPKINEMATICSEXPORT Joint : public IMP::Object {
30  friend class KinematicForest;
31  friend class CompositeJoint;
32 
34 
35  public:
36  //! Constructor.
37  /**
38  @param parent rigid body upstream of this joint
39  @param child rigid body downstream of this joint
40  @note we currently assume that a parent cannot be switched
41  */
43 
44  /***************** getter methods: ***************/
45 
46  public:
47  KinematicForest* get_owner_kf() const { return owner_kf_; }
48 
49  /**
50  returns the transformation of a vector from the child
51  reference frame to the parent reference frame in a safe way
52  (= after updating internal coordinates if needed)
53  */
54  // hack to make it compile on swig - this should be fixed as it might
55  // cause some pathologies
56  IMP_NO_SWIG(virtual)
57  const IMP::algebra::Transformation3D& get_transformation_child_to_parent()
58  const;
59 
60  IMP::core::RigidBody get_parent_node() const { return parent_; }
61 
62  IMP::core::RigidBody get_child_node() const { return child_; }
63 
64  protected:
65  /**
66  returns the transformation of a vector from the child
67  reference frame to the parent reference frame, without any checks
68  (= without updating internal coordinates even if needed)
69  */
70  // hack to make it compile on swig - this should be fixed as it might
71  // cause some pathologies
72  IMP_NO_SWIG(virtual)
73  const IMP::algebra::Transformation3D&
74  get_transformation_child_to_parent_no_checks() const {
75  return tr_child_to_parent_;
76  }
77 
78  /***************** setter methods: ***************/
79 
80  protected:
81  /** this sets the kinematic forest that manages this joint,
82  and also declares it as used (\see Object::set_was_used()
83  */
85  owner_kf_ = kf;
87  }
88 
89  /**
90  Sets the transformation from parent to child reference frame
91  (without any checks that internal coords are updated, and without
92  marking the owner internal coords as changed)
93  */
95  IMP::algebra::Transformation3D transformation) {
96  tr_child_to_parent_ = transformation;
97  }
98 
99  /**************** general methods: **************/
100 
101  /**
102  Updates the reference frame of the rigid body directly downstream
103  of this joint
104  */
105  virtual void update_child_node_reference_frame() const;
106 
107  /**
108  Updates the joint transformation based on external coordinates
109  of 'witness' particles.
110 
111  @note It is assumed that external coordinates are updated before
112  calling this function.
113  @note Witness particles do not necessarily belong to the child or
114  parent rigid bodes.
115  */
116  virtual void update_joint_from_cartesian_witnesses();
117 
118  private:
119  IMP::core::RigidBody parent_;
120  IMP::core::RigidBody child_;
121  IMP::algebra::Transformation3D tr_child_to_parent_;
122  KinematicForest* owner_kf_; // the tree that manages updates to this joint
123 };
124 
126 
127 IMPKINEMATICS_END_NAMESPACE
128 
129 #endif /* IMPKINEMATICS_JOINT_H */
Macros to hide code from SWIG.
Simple 3D transformation class.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Exception definitions and assertions.
Common base class for heavy weight IMP objects.
Definition: Object.h:111
functionality for defining nodes on a kinematic chain
#define IMP_NO_SWIG(x)
Hide the line when SWIG is compiled or parses it.
Definition: swig_macros.h:18
void set_transformation_child_to_parent_no_checks(IMP::algebra::Transformation3D transformation)
Definition: Joint.h:94
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
void set_owner_kf(KinematicForest *kf)
Definition: Joint.h:84
Helper macros for throwing and handling exceptions.
Base class for joints between rigid bodies in a kinematic tree.
Definition: Joint.h:29
A shared base class to help in debugging and things.
Simple 3D vector class.
Joint that combines several inner joints, acting on the same rigid body pair.
A decorator for a rigid body.
Definition: rigid_bodies.h:82
Define and manipulate a kinematic structure over a model.
void set_was_used(bool tf) const