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

Public Members | |||
![]() | ![]() | constraint ( const double u ) | |
![]() | ![]() | The only constructur for a constraint. More... | |
![]() | ![]() | virtual | ~constraint (void) |
![]() | ![]() | double | energy ( const double tol ) const |
![]() | ![]() | A dimensionless measure of the potential energy of the constraint. More... | |
![]() | ![]() | virtual void | energy ( const double tol, const vector< vector2 > &p, double &e, vector< vector2 > &dedp ) const = 0 |
![]() | ![]() | Calculate a dimensionless measure of the potential energy (e) of the constraint. More... | |
![]() | ![]() | double | uncertainty (void) const |
![]() | ![]() | A measure of how loose the constraint is. More... | |
![]() | ![]() | vector< vector2 * >& | points (void) |
![]() | ![]() | The points whose position the constraint directly applies to. More... | |
![]() | ![]() | const vector< vector2 * >& | points (void) const |
![]() | ![]() | The points whose position the constraint directly applies to. More... | |
![]() | ![]() | void | uncertainty ( const double u ) |
![]() | ![]() | Change the degree of uncertainty of the constraint. More... | |
Protected Members | |||
![]() | ![]() | vector< vector2 * > | points_ |
![]() | ![]() | The points returned by the points() memeber function. | |
The class provides a member function for measuring how well the point positions satisfy the constraint: an error function. This is referred to as the energy of the constraint by analogy with a spring constraint, for which the potential energy of the spring indicates how far the ends of the spring are from the rest positions.
The constraint is assumed to have a degree of accuracy; that is, the degree to which satisfying the constraint should be favoured over other constraints. This is analogous to the stiffness of a constraining spring.
Definition at line 51 of file constraint.h.
| constraint::constraint (const double u) |
The only constructur for a constraint.
| u |
the degree of uncertainty of the constriant.
|
assert( this->uncertainty() == u ); assert( this->points().empty() );
Definition at line 36 of file constraint.cpp.
constraint::~constraint (void) [virtual]
|
Definition at line 50 of file constraint.cpp.
| double constraint::energy (const double tol) const |
A dimensionless measure of the potential energy of the constraint.
Larger values indicate the constraint is less well satisfied. Conventionally, 0 is defined as the minimum possible energy, And energy <= 1 indicates that the constraint is satisifed to within the uncertainty() of the constraint.
The implementation of this member function uses the constraint::energy()(double,vector<vector2>,double&,vector<vector2>&) member function and the point positions indicated by points().
| tol | is a dimensionless calculation tolerance. |
assert( 0 < tol && tol < 1 ); assert( this->points()[i] ) for all i
Definition at line 71 of file constraint.cpp.
virtual void constraint::energy (const double tol, const vector<vector2>& p, double & e, vector<vector2>& dedp) const [pure virtual]
|
Calculate a dimensionless measure of the potential energy (e) of the constraint.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
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. Conventionally, 0 is defined as 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() == this->points().size() ); assert( 0 < tol && tol < 1 );
assert( dedp.size() == p.size() );
Reimplemented in angle_constraint, bearing_constraint, distance_constraint, through_constraint, and vector_constraint.
double constraint::uncertainty (void) const [inline]
|
A measure of how loose the constraint is.
Larger values indicate a looser constraint.
Definition at line 204 of file constraint.h.
vector<vector2 *>& constraint::points (void) [inline]
|
The points whose position the constraint directly applies to.
Moving these points can change the energy of the constraint; Moving anyother points never changes the ernegy of the constraint.
Definition at line 212 of file constraint.h.
const vector<vector2 *>& constraint::points (void) const [inline]
|
The points whose position the constraint directly applies to.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Moving these points can change the energy of the constraint; Moving anyother points never changes the ernegy of the constraint.
Definition at line 222 of file constraint.h.
| void constraint::uncertainty (const double u) |
Change the degree of uncertainty of the constraint.
| u |
the new degree of uncertainty
|
assert( 0.0 <= u );
assert( this->uncertainty() == u );
Definition at line 56 of file constraint.cpp.
vector< vector2 * > constraint::points_ [protected]
|
1.0.0 written by Dimitri van Heesch,
© 1997-1999