IMP  2.1.0
The Integrative Modeling Platform
DOF.h
Go to the documentation of this file.
1 /**
2  * \file kinematics/DOF.h
3  * \brief single degree of freedom
4  *
5  * \authors Dina Schneidman, Barak Raveh
6  * Copyright 2007-2013 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/base/Object.h>
15 #include <IMP/base/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::base::Object
31 {
33 public:
34 
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  // step size for going in the direction of the sampled value
49  double get_step_size() const
50  { return step_size_; }
51 
52  void set_step_size(double step_size)
53  { step_size_ = step_size; }
54 
55  // return the number of steps between the input value and current DOF value
56  int get_number_of_steps(double value) const;
57 
58  // return the number of steps between between the two values
59  int get_number_of_steps(double value1, double value2) const;
60 
61 private:
62  // initial value of DOF, the sampling samples around it
63  double value_;
64 
65  // sampling range
66  // TODO: provide an option for multiple ranges?
67  std::pair<double, double> range_;
68 
69  // step size
70  double step_size_;
71 };
72 
74 
75 IMPKINEMATICS_END_NAMESPACE
76 
77 #endif /* IMPKINEMATICS_DO_F_H */
#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.
Various general useful macros for IMP.
A shared base class to help in debugging and things.