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