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

bearing_constraint Class Reference

Constrain the bearing of a point, as measured from a second point. More...

#include <bearing_constraint.h>

Class diagram for bearing_constraint:

constraint

List of all members.


Public Members

 bearing_constraint ( const double u, const double b )
The only constructur for a bearing_constraint. More...

virtual ~bearing_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_bearing (void) const
Get the wanted bearing. More...

void wanted_bearing ( const double b )
Change the wanted bearing. More...


Friends

void assoc ( bearing_constraint &c, vector2 &p0, vector2 &p1 )
Associates a bearing_constraint with the 2 points it constrains. More...

void unassoc ( bearing_constraint &c )
Disassociates a bearing_constraint from the points it constrains. More...


Detailed Description

Constrain the bearing of a point, as measured from a second point.

Definition at line 40 of file bearing_constraint.h.


Member Function Documentation

bearing_constraint::bearing_constraint (const double u, const double b)

The only constructur for a bearing_constraint.

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

Postconditions:
 assert( this->uncertainty() == u );
 assert( this->wanted_bearing() == b );
 assert( this->points().size() == 2 );

Definition at line 40 of file bearing_constraint.cpp.

bearing_constraint::~bearing_constraint (void) [virtual]

Definition at line 60 of file bearing_constraint.cpp.

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

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

Reimplemented from constraint.

Definition at line 67 of file bearing_constraint.cpp.

double bearing_constraint::wanted_bearing (void) const [inline]

Get the wanted bearing.

The expected bearing of points()[1] from points()[0], in radians clockwise from north. Beware of confusion with the angle used for angle_constraint objects, which is positive anticlockwise. North is the direction (0,1), that is, the y-axis of the coordinate system.

Returns:
The wanted bearing.

Definition at line 155 of file bearing_constraint.h.

void bearing_constraint::wanted_bearing (const double d)

Change the wanted bearing.

Parameters:
b   the new wanted angle.

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

Postconditions:
 assert( this->wanted_bearing() == b );

Definition at line 124 of file bearing_constraint.cpp.


Friends And Related Function Documentation

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

Associates a bearing_constraint with the 2 points it constrains.

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

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

Definition at line 83 of file bearing_constraint.h.

void unassoc (bearing_constraint & c) [friend]

Disassociates a bearing_constraint from the points it constrains.

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

Definition at line 103 of file bearing_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