IMP logo
IMP Reference Guide  2.15.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-2021 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/nullptr.h>
18 #include <IMP/exception.h>
19 #include <IMP/core/internal/dihedral_helpers.h>
20 #include <IMP/algebra/Vector3D.h>
21 #include <IMP/check_macros.h>
22 #include <IMP/swig_macros.h>
23 
24 IMPKINEMATICS_BEGIN_NAMESPACE
25 
26 class KinematicForest;
27 
28 // TODO: make abstract?
29 //! Base class for joints between rigid bodies in a kinematic tree.
30 class IMPKINEMATICSEXPORT Joint : public IMP::Object {
31  friend class KinematicForest;
32  friend class CompositeJoint;
33 
35 
36  public:
37  //! Constructor.
38  /**
39  @param parent rigid body upstream of this joint
40  @param child rigid body downstream of this joint
41  @note we currently assume that a parent cannot be switched
42  */
44 
45  /***************** getter methods: ***************/
46 
47  public:
48  KinematicForest* get_owner_kf() const { return owner_kf_; }
49 
50  /**
51  returns the transformation of a vector from the child
52  reference frame to the parent reference frame in a safe way
53  (= after updating internal coordinates if needed)
54  */
55  // hack to make it compile on swig - this should be fixed as it might
56  // cause some pathologies
57  IMP_NO_SWIG(virtual)
58  const IMP::algebra::Transformation3D& get_transformation_child_to_parent()
59  const;
60 
61  IMP::core::RigidBody get_parent_node() const { return parent_; }
62 
63  IMP::core::RigidBody get_child_node() const { return child_; }
64 
65  protected:
66  /**
67  returns the transformation of a vector from the child
68  reference frame to the parent reference frame, without any checks
69  (= without updating internal coordinates even if needed)
70  */
71  // hack to make it compile on swig - this should be fixed as it might
72  // cause some pathologies
73  IMP_NO_SWIG(virtual)
74  const IMP::algebra::Transformation3D&
75  get_transformation_child_to_parent_no_checks() const {
76  return tr_child_to_parent_;
77  }
78 
79  /***************** setter methods: ***************/
80 
81  protected:
82  /** this sets the kinematic forest that manages this joint,
83  and also declares it as used (\see Object::set_was_used()
84  */
86  owner_kf_ = kf;
88  }
89 
90  /**
91  Sets the transformation from parent to child reference frame
92  (without any checks that internal coords are updated, and without
93  marking the owner internal coords as changed)
94  */
96  IMP::algebra::Transformation3D transformation) {
97  tr_child_to_parent_ = transformation;
98  }
99 
100  /**************** general methods: **************/
101 
102  /**
103  Updates the reference frame of the rigid body directly downstream
104  of this joint
105  */
106  virtual void update_child_node_reference_frame() const;
107 
108  /**
109  Updates the joint transformation based on external coordinates
110  of 'witness' particles.
111 
112  @note It is assumed that external coordinates are updated before
113  calling this function.
114  @note Witness particles do not necessarily belong to the child or
115  parent rigid bodes.
116  */
117  virtual void update_joint_from_cartesian_witnesses();
118 
119  private:
120  IMP::core::RigidBody parent_;
121  IMP::core::RigidBody child_;
122  IMP::algebra::Transformation3D tr_child_to_parent_;
123  KinematicForest* owner_kf_; // the tree that manages updates to this joint
124 };
125 
127 
128 IMPKINEMATICS_END_NAMESPACE
129 
130 #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:106
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:95
#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:85
Helper macros for throwing and handling exceptions.
Base class for joints between rigid bodies in a kinematic tree.
Definition: Joint.h:30
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