#include <QGLViewer/constraint.h>
An abstract class for Frame Constraints defined by an axis or a plane. More...
An abstract class for Frame Constraints defined by an axis or a plane.
AxisPlaneConstraint is an interface for (translation and/or rotation) Constraint that are defined by a direction. translationConstraintType() and rotationConstraintType() define how this direction should be interpreted: as an axis (AxisPlaneConstraint::AXIS) or as a plane normal (AxisPlaneConstraint::PLANE). See the Type() documentation for details.
The three implementations of this class: LocalConstraint, WorldConstraint and CameraConstraint differ by the coordinate system in which this direction is expressed.
Different implementations of this class are illustrated in the contrainedCamera and constrainedFrame examples.
Public Member Functions | |
AxisPlaneConstraint () | |
Default constructor. More... | |
virtual | ~AxisPlaneConstraint () |
Virtual destructor. More... | |
Translation constraint | |
virtual void | constrainTranslation (Vec &translation, Frame *const frame) |
Overloading of Constraint::constrainTranslation(). More... | |
void | setTranslationConstraint (Type type, const Vec &direction) |
Simply calls setTranslationConstraintType() and setTranslationConstraintDirection(). More... | |
void | setTranslationConstraintType (Type type) |
Sets the Type() of the translationConstraintType(). More... | |
void | setTranslationConstraintDirection (const Vec &direction) |
Defines the translationConstraintDirection(). More... | |
Type | translationConstraintType () const |
Returns the translation constraint Type(). More... | |
Vec | translationConstraintDirection () const |
Returns the direction used by the translation constraint. More... | |
Public Member Functions inherited from qglviewer::Constraint | |
virtual | ~Constraint () |
Virtual destructor. More... | |
Rotation constraint | |
virtual void | constrainRotation (Quaternion &rotation, Frame *const frame) |
Overloading of Constraint::constrainRotation(). More... | |
void | setRotationConstraint (Type type, const Vec &direction) |
Simply calls setRotationConstraintType() and setRotationConstraintDirection(). More... | |
void | setRotationConstraintType (Type type) |
Set the Type() of the rotationConstraintType(). More... | |
void | setRotationConstraintDirection (const Vec &direction) |
Defines the rotationConstraintDirection(). More... | |
Type | rotationConstraintType () const |
Returns the rotation constraint Type(). More... | |
Vec | rotationConstraintDirection () const |
Returns the axis direction used by the rotation constraint. More... | |
AxisPlaneConstraint::AxisPlaneConstraint | ( | ) |
Default constructor.
translationConstraintType() and rotationConstraintType() are set to AxisPlaneConstraint::FREE. translationConstraintDirection() and rotationConstraintDirection() are set to (0,0,0).
|
inlinevirtual |
Virtual destructor.
Empty.
|
inlinevirtual |
Overloading of Constraint::constrainRotation().
Empty.
Reimplemented from qglviewer::Constraint.
Reimplemented in qglviewer::CameraConstraint, qglviewer::WorldConstraint, and qglviewer::LocalConstraint.
|
inlinevirtual |
Overloading of Constraint::constrainTranslation().
Empty
Reimplemented from qglviewer::Constraint.
Reimplemented in qglviewer::CameraConstraint, qglviewer::WorldConstraint, and qglviewer::LocalConstraint.
|
inline |
Returns the axis direction used by the rotation constraint.
This direction is defined only when rotationConstraintType() is AxisPlaneConstraint::AXIS.
The AxisPlaneConstraint derived classes express this direction in different coordinate system (camera for CameraConstraint, local for LocalConstraint, and world for WorldConstraint). This value can be modified with setRotationConstraintDirection().
|
inline |
Returns the rotation constraint Type().
Simply calls setRotationConstraintType() and setRotationConstraintDirection().
void AxisPlaneConstraint::setRotationConstraintDirection | ( | const Vec & | direction | ) |
Defines the rotationConstraintDirection().
The coordinate system where direction
is expressed depends on your class implementation.
void AxisPlaneConstraint::setRotationConstraintType | ( | Type | type | ) |
Set the Type() of the rotationConstraintType().
Default is AxisPlaneConstraint::FREE.
Depending on this value, the Frame will freely rotate (AxisPlaneConstraint::FREE), will only be able to rotate around an axis (AxisPlaneConstraint::AXIS), or will not able to rotate at all (AxisPlaneConstraint::FORBIDDEN).
Use Frame::setOrientation() to define the orientation of the constrained Frame before it gets constrained.
Simply calls setTranslationConstraintType() and setTranslationConstraintDirection().
void AxisPlaneConstraint::setTranslationConstraintDirection | ( | const Vec & | direction | ) |
Defines the translationConstraintDirection().
The coordinate system where direction
is expressed depends on your class implementation.
|
inline |
Sets the Type() of the translationConstraintType().
Default is AxisPlaneConstraint::FREE.
|
inline |
Returns the direction used by the translation constraint.
It represents the axis direction (AxisPlaneConstraint::AXIS) or the plane normal (AxisPlaneConstraint::PLANE) depending on the translationConstraintType(). It is undefined for AxisPlaneConstraint::FREE or AxisPlaneConstraint::FORBIDDEN.
The AxisPlaneConstraint derived classes express this direction in different coordinate system (camera for CameraConstraint, local for LocalConstraint, and world for WorldConstraint). This value can be modified with setTranslationConstraintDirection().
|
inline |
Returns the translation constraint Type().
Depending on this value, the Frame will freely translate (AxisPlaneConstraint::FREE), will only be able to translate along an axis direction (AxisPlaneConstraint::AXIS), will be forced to stay into a plane (AxisPlaneConstraint::PLANE) or will not able to translate at all (AxisPlaneConstraint::FORBIDDEN).
Use Frame::setPosition() to define the position of the constrained Frame before it gets constrained.
Type lists the different types of translation and rotation constraints that are available.
It specifies the meaning of the constraint direction (see translationConstraintDirection() and rotationConstraintDirection()): as an axis direction (AxisPlaneConstraint::AXIS) or a plane normal (AxisPlaneConstraint::PLANE). AxisPlaneConstraint::FREE means no constraint while AxisPlaneConstraint::FORBIDDEN completely forbids the translation and/or the rotation.
See translationConstraintType() and rotationConstraintType().
New derived classes can use their own extended enum for specific constraints:
Enumerator | |
---|---|
FREE | |
AXIS | |
PLANE | |
FORBIDDEN |