Main Page   Class Hierarchy   Compound List   Compound Members  

qglviewer::Constraint Class Reference

A base class for Frame constraints. More...

Inherited by qglviewer::AxisPlaneConstraint, and qglviewer::TriangleSetConstraint.

List of all members.

Public Methods

virtual ~Constraint ()
virtual void constrainTranslation (qglviewer::Vec &, Frame *const)
virtual void constrainRotation (qglviewer::Quaternion &, Frame *const)


Detailed Description

A base class for Frame constraints.

The different constraints that can be applied to a Frame to limit its motion must all derive from this class. A frame can have its constrain defined with Frame::setConstraint().

constrainTranslation() and constrainRotation() can be overloaded to specify the constraint behavior. They take the motion and the applied frame as parameters. The translation (resp. rotation) should be modified according to the constraint.

A frame can be moved with constraints using Frame::translate() and Frame::rotate(). It will result in the following pseudo-code for an imposed translation T and rotation Q :

   constraint()->constrainTranslation( T , this );
   t += T;
   constraint()->constrainRotation   ( Q , this );
   q *= Q;

Default behavior (Constraint base class) implements no constraint.

Attention:
Frame::setTranslation(), Frame::setRotation() and similar functions will actually set the frame position and orientation, and the constraint will not be used.


Constructor & Destructor Documentation

virtual ~Constraint   [inline, virtual]
 

Virtual empty destructor.


Member Function Documentation

virtual void constrainRotation qglviewer::Quaternion  ,
Frame   const
[inline, virtual]
 

Default un-constrained rotation function. Desired rotation is expressed in local frame coordinate system. Try the constrainedFrame and constrainedCamera examples for an illustration.

Overload this function in your own Constraint class to define a new rotationnal constraint. The frame which is applied a constrained rotation is given as a parameter. It is not defined const, but you should refrain from directly changing its value in the constraint.

Reimplemented in qglviewer::AxisPlaneConstraint.

virtual void constrainTranslation qglviewer::Vec  ,
Frame   const
[inline, virtual]
 

Default un-constrained translation function. Desired translation is expressed in local frame coordinate system. Try the constrainedFrame and constrainedCamera examples for an illustration.

Overload this function in your own Constraint class to define a new translation constraint. The frame which is applied a constrained translation is given as a parameter. It is not defined const, but you should refrain from directly changing its value in the constraint.

Reimplemented in qglviewer::AxisPlaneConstraint.


Generated on Thu Jan 16 12:53:47 2003 for libQGLViewer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002