Main Page   Namespace List   Class Hierarchy   Compound List   File List   Header Files   Sources   Namespace Members   Compound Members   File Members  

constraint Class Reference

Constrain the positions of some points in some way. More...

#include <constraint.h>

Class diagram for constraint:

vector_constraint through_constraint distance_constraint bearing_constraint angle_constraint

List of all members.


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.


Detailed Description

Constrain the positions of some points in some way.

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.


Member Function Documentation

constraint::constraint (const double u)

The only constructur for a constraint.

Parameters:
u   the degree of uncertainty of the constriant.

Postconditions:
 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().

Parameters:
tol   is a dimensionless calculation tolerance.
Returns:
The energy of the constraint.

Preconditions:
 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.

Parameters:
tol   is a dimensionless calculation tolerance.
p   are the point positions.
Return values:
e   the energy.
dedp   is the rate of change of energy with position.

Preconditions:
 assert( p.size() == this->points().size() );
 assert( 0 < tol && tol < 1 );

Postconditions:
 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.

Returns:
The degree of uncertainty.

Normally:
The degree of uncertainty is measured in terms of a characteristic distance. If the point positions are this distance from the desired position, the energy of the constraint is 1.0.

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.

Parameters:
u   the new degree of uncertainty

Preconditions:
 assert( 0.0 <= u );

Postconditions:
 assert( this->uncertainty() == u );

Definition at line 56 of file constraint.cpp.


Member Data Documentation

vector< vector2 * > constraint::points_ [protected]

The points returned by the points() memeber function.

Definition at line 198 of file constraint.h.


The documentation for this class was generated from the following files:
Generated at Sun Jul 14 20:38:16 2002 for Mapper by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999