11 #ifndef IMPKINEMATICS_DOF_VALUES_H
12 #define IMPKINEMATICS_DOF_VALUES_H
17 IMPKINEMATICS_BEGIN_NAMESPACE
20 class IMPKINEMATICSEXPORT
DOFValues :
public std::vector<double> {
25 for (
unsigned int i = 0; i < dofs.size(); i++)
26 push_back(dofs[i]->get_value());
34 double get_distance2(
const DOFValues& other_dof_values)
const {
36 for(
unsigned int i=0; i<size(); i++) {
37 double diff1 = ((*this)[i] - other_dof_values[i]);
40 double diff = std::min(std::fabs(diff1), std::min(diff2, diff3));
46 double get_distance2(
const DOFValues& other_dof_values,
47 const std::vector<bool>& active_dofs)
const {
49 unsigned int asize = 0;
50 for(
unsigned int i=0; i<size(); i++) {
51 if(active_dofs.size() == 0 || active_dofs[i]) {
52 double diff1 = ((*this)[i] - other_dof_values[i]);
55 double diff = std::min(std::fabs(diff1), std::min(diff2, diff3));
63 double get_distance(
const DOFValues& other_dof_values)
const {
64 return sqrt(get_distance2(other_dof_values));
68 const std::vector<bool>& active_dofs)
const {
69 return sqrt(get_distance2(other_dof_values, active_dofs));
78 for (
unsigned int i = 1; i < size(); i++) {
79 out <<
"," << operator[](i);
87 IMPKINEMATICS_END_NAMESPACE
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
static const double PI
the constant pi
DOFValues()
Empty Constructor.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
DOFValues(const DOFs &dofs)
Constructor from DOFs.
A class that holds DOF values for DOFs.
Various useful constants.
double get_distance(const Line3D &s, const Vector3D &p)
Get closest distance between a line and a point.