Main Page | Class Hierarchy | Compound List | All functions | Search

TriangleSetConstraint Class Reference

A translation Constraint defined with respect to a set of triangles. More...

Inherits Constraint.

List of all members.

Public Member Functions

 TriangleSetConstraint ()
virtual ~TriangleSetConstraint ()
virtual void constrainTranslation (Vec &, Frame *const)
unsigned int addPoint (const Vec &p)
unsigned int addTriangle (const unsigned int i0, const unsigned int i1, const unsigned int i2)
int indexOfPoint (const Vec &p) const
unsigned int currentTriangle () const
void setCurrentTriangle (const unsigned int ct)
float epsilon () const
void setEpsilon (const float e)
Vec point (unsigned int index) const
int neighTriangle (unsigned int index, unsigned short edge) const
unsigned int trianglePoint (unsigned int index, unsigned short nb) const


Detailed Description

A translation Constraint defined with respect to a set of triangles.

Define your path (connected set of triangles) using addPoint() and addTriangle(). The frame will then be constrained to move on this path.

Development version. Many things need to be cleared.

See triSetConstraint for an illustration.


Constructor & Destructor Documentation

TriangleSetConstraint  )  [inline]
 

Create an empty TriangleSetConstraint. currentTriangle() set to 0.

virtual ~TriangleSetConstraint  )  [inline, virtual]
 

Virtual empty destructor.


Member Function Documentation

unsigned int addPoint const Vec p  ) 
 

Add a point to the triangle set. Use addTriangle() to create a triangle with this point. Returns the index of the point in the internal list.

If this point is within a range of epsilon() around an already entered point, the point is not added. The returned index is the one of the first point. See indexOfPoint().

unsigned int addTriangle const unsigned int  i0,
const unsigned int  i1,
const unsigned int  i2
 

Add a triangle between the three points whose indexes are given. Point are added with addPoint(), which returns their index. Returns the index of the created triangle (used by currentTriangle()).

void constrainTranslation Vec trans,
Frame const
[virtual]
 

Constrain the translation trans with respect to a path defined by a triangle set. See addTriangle() and addPoint().

Reimplemented from Constraint.

unsigned int currentTriangle  )  const [inline]
 

The index of the triangle the frame is currently on. Changes as the frame moves on the triangle set.

float epsilon  )  const [inline]
 

The current value of epsilon, used to determine identical points in addPoint().

int indexOfPoint const Vec p  )  const
 

Returns the index of point in the point list. Returns -1 if not found. Two points are declared identical if their distance is lower or equal than epsilon().

int neighTriangle unsigned int  index,
unsigned short  edge
const [inline]
 

Returns the adjacent triangle of triangle index, along its edge edge.

Vec point unsigned int  index  )  const [inline]
 

Returns the coordinates of the point at index.

void setCurrentTriangle const unsigned int  ct  ) 
 

Use this function to initialize the constraint. You should give the index of the triangle the frame is currently on (use Frame::setPosition() to move the frame if needed). If the constraint is lost and currentTriangle() is not valid, the frame will be positioned back to the center of the previous currentTriangle().

void setEpsilon const float  e  )  [inline]
 

Set the current value of epsilon, used to determine identical points in addPoint(). Default value is 0.0.

unsigned int trianglePoint unsigned int  index,
unsigned short  nb
const [inline]
 

Returns the index of the nb point of triangle index.


Generated on Wed Feb 11 17:22:08 2004 for libQGLViewer by doxygen 1.3.3