#include <distance_constraint.h>
Class diagram for distance_constraint:

Public Members | |||
![]() | ![]() | distance_constraint ( const double u, const double d ) | |
![]() | ![]() | The only constructur for a distance_constraint. More... | |
![]() | ![]() | virtual | ~distance_constraint (void) |
![]() | ![]() | virtual void | energy ( const double tol, const vector< vector2 > &p, double &e, vector< vector2 > &dedp ) const |
![]() | ![]() | Calculate a dimensionless measure of the potential energy (e) of the constraint. More... | |
![]() | ![]() | double | wanted_distance (void) const |
![]() | ![]() | Get the wanted distance between the two points. More... | |
![]() | ![]() | void | wanted_distance ( const double d ) |
![]() | ![]() | Change the wanted distance between the two points. More... | |
Friends | |||
![]() | ![]() | void | assoc ( distance_constraint &c, vector2 &p0, vector2 &p1 ) |
![]() | ![]() | Associates a distance_constraint with the 2 points it constrains. More... | |
![]() | ![]() | void | unassoc ( distance_constraint &c ) |
![]() | ![]() | Disassociates a distance_constraint from the points it constrains. More... | |
Definition at line 39 of file distance_constraint.h.
| distance_constraint::distance_constraint (const double u, const double d) |
The only constructur for a distance_constraint.
| u | the degree of uncertainty of the constriant. |
| d |
the distance to which the points should be constrained.
|
assert( 0.0 < u ). assert( 0.0 <= d );
assert( this->uncertainty() == u ); assert( this->wanted_distance() == d ); assert( this->points().size() == 2 ); assert( this->points()[0] == 0 ); assert( this->points()[1] == 0 );
assert( !this->points()[0] || !this->points()[1] ||
this->energy() == pow(
(this->distance() - this->wanted_distance())/this->uncertainty(),
2 ) );Definition at line 37 of file distance_constraint.cpp.
distance_constraint::~distance_constraint (void) [virtual]
|
Definition at line 63 of file distance_constraint.cpp.
void distance_constraint::energy (const double tol, const vector<vector2>& p, double & e, vector<vector2>& dedp) const [virtual]
|
Calculate a dimensionless measure of the potential energy (e) of the constraint.
This is equivalent to a measure of how poorly the constraint is satisfied. If *(this->points()[i]) had position p[i], it calculates the energy (e) and the rates of change of that energy (dedp) with respect to the point positions. Larger values indicate the constraint is less well satisfied. 0 is the minimum possible energy, and energy <= 1 indicates that the constraint is satisifed to within the uncertainty of the constraint.
| tol | is a dimensionless calculation tolerance. |
| p | are the point positions. |
| e | the energy. |
| dedp |
is the rate of change of energy with position.
|
assert( p.size() == 2 ); assert( 0 < tol && tol < 1 );
assert( dedp.size() == 2 );
Reimplemented from constraint.
Definition at line 70 of file distance_constraint.cpp.
double distance_constraint::wanted_distance (void) const [inline]
|
Get the wanted distance between the two points.
The expected distance from points()[0] to points()[1].
Definition at line 166 of file distance_constraint.h.
| void distance_constraint::wanted_distance (const double d) |
Change the wanted distance between the two points.
| the |
new wanted distance.
|
assert( 0.0 <= d );
assert( this->wanted_distance() == d );
Definition at line 115 of file distance_constraint.cpp.
void assoc (distance_constraint & c, vector2 & p0, vector2 & p1) [friend]
|
Associates a distance_constraint with the 2 points it constrains.
assert( !c.points()[0] ); assert( !c.points()[1] );
assert( c.points()[0] == &p0 ); assert( c.points()[1] == &p1 );
Definition at line 119 of file distance_constraint.h.
void unassoc (distance_constraint & c) [friend]
|
Disassociates a distance_constraint from the points it constrains.
assert( !c.points()[0] ); assert( !c.points()[1] );
Definition at line 139 of file distance_constraint.h.
1.0.0 written by Dimitri van Heesch,
© 1997-1999