IMP logo
IMP Reference Guide  2.6.2
The Integrative Modeling Platform
DOF.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kinematics/DOF.h
3  * \brief single degree of freedom
4  *
5  * \authors Dina Schneidman, Barak Raveh
6  * Copyright 2007-2016 IMP Inventors. All rights reserved.
7  *
8  */
9 
10 #ifndef IMPKINEMATICS_DO_F_H
11 #define IMPKINEMATICS_DO_F_H
12 
13 #include "kinematics_config.h"
14 #include <IMP/Object.h>
15 #include <IMP/object_macros.h>
16 
17 IMPKINEMATICS_BEGIN_NAMESPACE
18 
19 /**
20  A general class for representing one degree of freedom (DOF) that is
21  a double. the class holds min/max range for the DOF, as well as the
22  step size for passing the DOFs values around. It relies on a
23  DOFValues class that only holds DOF value for each DOF
24 
25  @note Typically, a DOF would correspond to one joint, with the exception
26  of transformation joint that has 6 DOFs (though collective joints
27  such as normal modes might be supported in principle)
28 
29  */
30 class IMPKINEMATICSEXPORT DOF : public IMP::Object {
32 
33  public:
34  // maybe delete this one, only leave the next constructor?
35  DOF(double v);
36 
37  DOF(double v, double min, double max, double step_size);
38 
39  double get_value() const { return value_; }
40 
41  void set_value(double v) { value_ = v; }
42 
43  std::pair<double, double> get_range() const { return range_; }
44 
45  void set_range(std::pair<double, double> range) { range_ = range; }
46 
47  // step size for going in the direction of the sampled value
48  double get_step_size() const { return step_size_; }
49 
50  void set_step_size(double step_size) { step_size_ = step_size; }
51 
52  // return the number of steps between the input value and current DOF value
53  int get_number_of_steps(double value) const;
54 
55  // return the number of steps between between the two values
56  int get_number_of_steps(double value1, double value2) const;
57 
58  private:
59  // initial value of DOF, the sampling samples around it
60  double value_;
61 
62  // sampling range
63  // TODO: provide an option for multiple ranges?
64  std::pair<double, double> range_;
65 
66  // step size
67  double step_size_;
68 };
69 
71 
72 IMPKINEMATICS_END_NAMESPACE
73 
74 #endif /* IMPKINEMATICS_DO_F_H */
Various general useful macros for IMP.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Common base class for heavy weight IMP objects.
Definition: Object.h:106
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
A shared base class to help in debugging and things.