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

angle_constraint Class Reference

Constrain the relative bearing of two points, as measured from a third point. More...

#include <angle_constraint.h>

Class diagram for angle_constraint:

constraint

List of all members.


Public Members

 angle_constraint ( const double u, const double a )
The only constructor for an angle_constraint. More...

virtual ~angle_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_angle (void) const
Get the wanted angle. More...

void wanted_angle ( const double a )
Change the wanted angle. More...


Friends

void assoc ( angle_constraint &c, vector2 &p0, vector2 &p1, vector2 &p2 )
Associates an angle_constraint with the 3 points it constrains. More...

void unassoc ( angle_constraint &c )
Disassociates an angle_constraint from the points it constrains. More...


Detailed Description

Constrain the relative bearing of two points, as measured from a third point.

Definition at line 40 of file angle_constraint.h.


Member Function Documentation

angle_constraint::angle_constraint (const double u, const double a)

The only constructor for an angle_constraint.

Parameters:
u   the degree of uncertainty of the constriant.
a   the angle to which the points should be constrained.

Preconditions:
 assert( 0.0 < u ).

Postconditions:
 assert( this->uncertainty() == u );
 assert( this->wanted_angle() == a );
 assert( this->points().size() == 3 );

Definition at line 40 of file angle_constraint.cpp.

angle_constraint::~angle_constraint (void) [virtual]

Definition at line 63 of file angle_constraint.cpp.

void angle_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.

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() == 3 );
 assert( 0 < tol && tol < 1 );

Postconditions:
 assert( dedp.size() == 3 );

Reimplemented from constraint.

Definition at line 104 of file angle_constraint.cpp.

double angle_constraint::wanted_angle (void) const [inline]

Get the wanted angle.

The expected angle from points()[1] to points()[2], in radians, measured from points()[0]. Note that this angle is measured in the usual mathematical sense: positive anticlockwise. Beware of confusion with the angle used for bearing_constraint objects, which is positive clockwise.

Returns:
The wanted angle.

Definition at line 163 of file angle_constraint.h.

void angle_constraint::wanted_angle (const double a)

Change the wanted angle.

Parameters:
a   the new wanted angle.

Preconditions:
 assert( 0.0 <= a && a < 2*pi);

Postconditions:
 assert( this->wanted_angle() == a );

Friends And Related Function Documentation

void assoc (angle_constraint & c, vector2 & p0, vector2 & p1, vector2 & p1) [friend]

Associates an angle_constraint with the 3 points it constrains.

Preconditions:
 assert( !c.points()[0] );
 assert( !c.points()[1] );
 assert( !c.points()[2] );

Postconditions:
 assert( c.points()[0] == &p0 );
 assert( c.points()[1] == &p1 );
 assert( c.points()[2] == &p2 );

Definition at line 41 of file angle_constraint.h.

void unassoc (angle_constraint & c) [friend]

Disassociates an angle_constraint from the points it constrains.

Postconditions:
 assert( !c.points()[0] );
 assert( !c.points()[1] );
 assert( !c.points()[2] );

Definition at line 65 of file angle_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