The Frame class represents a coordinate system, defined by a position and an orientation. More...
Signals | |
void | interpolated () |
This signal is emitted when the Frame is interpolated by a KeyFrameInterpolator. More... | |
void | modified () |
This signal is emitted whenever the position() or the orientation() of the Frame is modified. More... | |
Public Member Functions | |
Frame () | |
Creates a default Frame. More... | |
Frame (const Frame &frame) | |
Copy constructor. More... | |
virtual | ~Frame () |
Virtual destructor. More... | |
Frame & | operator= (const Frame &frame) |
Equal operator. More... | |
World coordinates position and orientation | |
Frame (const Vec &position, const Quaternion &orientation) | |
Creates a Frame with a position() and an orientation(). More... | |
void | setPosition (const Vec &position) |
Sets the position() of the Frame, defined in the world coordinate system. More... | |
void | setPosition (float x, float y, float z) |
Same as setPosition(), but with float parameters. More... | |
void | setPositionWithConstraint (Vec &position) |
Same as setPosition(), but position is modified so that the potential constraint() of the Frame is satisfied. More... | |
void | setOrientation (const Quaternion &orientation) |
Sets the orientation() of the Frame, defined in the world coordinate system. More... | |
void | setOrientation (double q0, double q1, double q2, double q3) |
Same as setOrientation(), but with float parameters. More... | |
void | setOrientationWithConstraint (Quaternion &orientation) |
Same as setOrientation(), but orientation is modified so that the potential constraint() of the Frame is satisfied. More... | |
void | setPositionAndOrientation (const Vec &position, const Quaternion &orientation) |
Same as successive calls to setPosition() and then setOrientation(). More... | |
void | setPositionAndOrientationWithConstraint (Vec &position, Quaternion &orientation) |
Same as setPositionAndOrientation() but position and orientation are modified to satisfy the constraint. More... | |
Vec | position () const |
Returns the position of the Frame, defined in the world coordinate system. More... | |
Quaternion | orientation () const |
Returns the orientation of the Frame, defined in the world coordinate system. More... | |
void | getPosition (float &x, float &y, float &z) const |
x , y and z are set to the position() of the Frame. More... | |
void | getOrientation (double &q0, double &q1, double &q2, double &q3) const |
Get the current orientation of the frame (same as orientation()). More... | |
Local translation and rotation w/r reference Frame | |
void | setTranslation (const Vec &translation) |
Sets the translation() of the frame, locally defined with respect to the referenceFrame(). More... | |
void | setTranslation (float x, float y, float z) |
Same as setTranslation(), but with float parameters. More... | |
void | setTranslationWithConstraint (Vec &translation) |
Same as setTranslation(), but translation is modified so that the potential constraint() of the Frame is satisfied. More... | |
void | setRotation (const Quaternion &rotation) |
Set the current rotation Quaternion. More... | |
void | setRotation (double q0, double q1, double q2, double q3) |
Same as setRotation() but with float Quaternion parameters. More... | |
void | setRotationWithConstraint (Quaternion &rotation) |
Same as setRotation(), but rotation is modified so that the potential constraint() of the Frame is satisfied. More... | |
void | setTranslationAndRotation (const Vec &translation, const Quaternion &rotation) |
Same as successive calls to setTranslation() and then setRotation(). More... | |
void | setTranslationAndRotationWithConstraint (Vec &translation, Quaternion &rotation) |
Same as setTranslationAndRotation(), but translation and orientation are modified to satisfy the constraint(). More... | |
Vec | translation () const |
Returns the Frame translation, defined with respect to the referenceFrame(). More... | |
Quaternion | rotation () const |
Returns the Frame rotation, defined with respect to the referenceFrame(). More... | |
void | getTranslation (float &x, float &y, float &z) const |
Fill x , y and z with the translation() of the Frame. More... | |
void | getRotation (double &q0, double &q1, double &q2, double &q3) const |
The q are set to the rotation() of the Frame. More... | |
Frame hierarchy | |
const Frame * | referenceFrame () const |
Returns the reference Frame, in which coordinates system the Frame is defined. More... | |
void | setReferenceFrame (const Frame *const refFrame) |
Sets the referenceFrame() of the Frame. More... | |
bool | settingAsReferenceFrameWillCreateALoop (const Frame *const frame) |
Returns true if setting frame as the Frame's referenceFrame() would create a loop in the Frame hierarchy. More... | |
Frame modification | |
void | translate (Vec &t) |
Same as translate(const Vec&) but t may be modified to satisfy the translation constraint(). More... | |
void | translate (const Vec &t) |
Translates the Frame of t (defined in the Frame coordinate system). More... | |
void | translate (float x, float y, float z) |
Same as translate(const Vec&) but with float parameters. More... | |
void | translate (float &x, float &y, float &z) |
Same as translate(Vec&) but with float parameters. More... | |
void | rotate (Quaternion &q) |
Same as rotate(const Quaternion&) but q may be modified to satisfy the rotation constraint(). More... | |
void | rotate (const Quaternion &q) |
Rotates the Frame by q (defined in the Frame coordinate system): R = R*q. More... | |
void | rotate (double q0, double q1, double q2, double q3) |
Same as rotate(const Quaternion&) but with float Quaternion parameters. More... | |
void | rotate (double &q0, double &q1, double &q2, double &q3) |
Same as rotate(Quaternion&) but with float Quaternion parameters. More... | |
void | rotateAroundPoint (Quaternion &rotation, const Vec &point) |
Makes the Frame rotate() by rotation around point . More... | |
void | rotateAroundPoint (const Quaternion &rotation, const Vec &point) |
Same as rotateAroundPoint(), but with a const rotation Quaternion. More... | |
void | alignWithFrame (const Frame *const frame, bool move=false, float threshold=0.0f) |
Aligns the Frame with frame , so that two of their axis are parallel. More... | |
void | projectOnLine (const Vec &origin, const Vec &direction) |
Translates the Frame so that its position() lies on the line defined by origin and direction (defined in the world coordinate system). More... | |
Coordinate system transformation of 3D coordinates | |
Vec | coordinatesOf (const Vec &src) const |
Returns the Frame coordinates of a point src defined in the world coordinate system (converts from world to Frame). More... | |
Vec | inverseCoordinatesOf (const Vec &src) const |
Returns the world coordinates of the point whose position in the Frame coordinate system is src (converts from Frame to world). More... | |
Vec | localCoordinatesOf (const Vec &src) const |
Returns the Frame coordinates of a point src defined in the referenceFrame() coordinate system (converts from referenceFrame() to Frame). More... | |
Vec | localInverseCoordinatesOf (const Vec &src) const |
Returns the referenceFrame() coordinates of a point src defined in the Frame coordinate system (converts from Frame to referenceFrame()). More... | |
Vec | coordinatesOfIn (const Vec &src, const Frame *const in) const |
Returns the in coordinates of the point whose position in the Frame coordinate system is src (converts from Frame to in ). More... | |
Vec | coordinatesOfFrom (const Vec &src, const Frame *const from) const |
Returns the Frame coordinates of the point whose position in the from coordinate system is src (converts from from to Frame). More... | |
void | getCoordinatesOf (const float src[3], float res[3]) const |
Same as coordinatesOf(), but with float parameters. More... | |
void | getInverseCoordinatesOf (const float src[3], float res[3]) const |
Same as inverseCoordinatesOf(), but with float parameters. More... | |
void | getLocalCoordinatesOf (const float src[3], float res[3]) const |
Same as localCoordinatesOf(), but with float parameters. More... | |
void | getLocalInverseCoordinatesOf (const float src[3], float res[3]) const |
Same as localInverseCoordinatesOf(), but with float parameters. More... | |
void | getCoordinatesOfIn (const float src[3], float res[3], const Frame *const in) const |
Same as coordinatesOfIn(), but with float parameters. More... | |
void | getCoordinatesOfFrom (const float src[3], float res[3], const Frame *const from) const |
Same as coordinatesOfFrom(), but with float parameters. More... | |
Coordinate system transformation of vectors | |
Vec | transformOf (const Vec &src) const |
Returns the Frame transform of a vector src defined in the world coordinate system (converts vectors from world to Frame). More... | |
Vec | inverseTransformOf (const Vec &src) const |
Returns the world transform of the vector whose coordinates in the Frame coordinate system is src (converts vectors from Frame to world). More... | |
Vec | localTransformOf (const Vec &src) const |
Returns the Frame transform of a vector src defined in the referenceFrame() coordinate system (converts vectors from referenceFrame() to Frame). More... | |
Vec | localInverseTransformOf (const Vec &src) const |
Returns the referenceFrame() transform of a vector src defined in the Frame coordinate system (converts vectors from Frame to referenceFrame()). More... | |
Vec | transformOfIn (const Vec &src, const Frame *const in) const |
Returns the in transform of the vector whose coordinates in the Frame coordinate system is src (converts vectors from Frame to in ). More... | |
Vec | transformOfFrom (const Vec &src, const Frame *const from) const |
Returns the Frame transform of the vector whose coordinates in the from coordinate system is src (converts vectors from from to Frame). More... | |
void | getTransformOf (const float src[3], float res[3]) const |
Same as transformOf(), but with float parameters. More... | |
void | getInverseTransformOf (const float src[3], float res[3]) const |
Same as inverseTransformOf(), but with float parameters. More... | |
void | getLocalTransformOf (const float src[3], float res[3]) const |
Same as localTransformOf(), but with float parameters. More... | |
void | getLocalInverseTransformOf (const float src[3], float res[3]) const |
Same as localInverseTransformOf(), but with float parameters. More... | |
void | getTransformOfIn (const float src[3], float res[3], const Frame *const in) const |
Same as transformOfIn(), but with float parameters. More... | |
void | getTransformOfFrom (const float src[3], float res[3], const Frame *const from) const |
Same as transformOfFrom(), but with float parameters. More... | |
Constraint on the displacement | |
Constraint * | constraint () const |
Returns the current constraint applied to the Frame. More... | |
void | setConstraint (Constraint *const constraint) |
Sets the constraint() attached to the Frame. More... | |
Associated matrices | |
const GLdouble * | matrix () const |
Returns the 4x4 OpenGL transformation matrix represented by the Frame. More... | |
void | getMatrix (GLdouble m[4][4]) const |
GLdouble [4][4] version of matrix(). More... | |
void | getMatrix (GLdouble m[16]) const |
GLdouble [16] version of matrix(). More... | |
const GLdouble * | worldMatrix () const |
Returns the 4x4 OpenGL transformation matrix represented by the Frame. More... | |
void | getWorldMatrix (GLdouble m[4][4]) const |
float[4][4] parameter version of worldMatrix(). More... | |
void | getWorldMatrix (GLdouble m[16]) const |
float[16] parameter version of worldMatrix(). More... | |
void | setFromMatrix (const GLdouble m[4][4]) |
This is an overloaded method provided for convenience. More... | |
void | setFromMatrix (const GLdouble m[16]) |
Sets the Frame from an OpenGL matrix representation (rotation in the upper left 3x3 matrix and translation on the last line). More... | |
Inversion of the transformation | |
Frame | inverse () const |
Returns a Frame representing the inverse of the Frame space transformation. More... | |
Frame | worldInverse () const |
Returns the inverse() of the Frame world transformation. More... | |
XML representation | |
virtual QDomElement | domElement (const QString &name, QDomDocument &document) const |
Returns an XML QDomElement that represents the Frame. More... | |
virtual void | initFromDOMElement (const QDomElement &element) |
Restores the Frame state from a QDomElement created by domElement(). More... | |
Detailed Description
The Frame class represents a coordinate system, defined by a position and an orientation.
A Frame is a 3D coordinate system, represented by a position() and an orientation(). The order of these transformations is important: the Frame is first translated and then rotated around the new translated origin.
A Frame is useful to define the position and orientation of a 3D rigid object, using its matrix() method, as shown below:
Many functions are provided to transform a 3D point from one coordinate system (Frame) to an other: see coordinatesOf(), inverseCoordinatesOf(), coordinatesOfIn(), coordinatesOfFrom()...
You may also want to transform a 3D vector (such as a normal), which corresponds to applying only the rotational part of the frame transformation: see transformOf() and inverseTransformOf(). See the frameTransform example for an illustration.
The translation() and the rotation() that are encapsulated in a Frame can also be used to represent a rigid transformation of space. Such a transformation can also be interpreted as a change of coordinate system, and the coordinate system conversion functions actually allow you to use a Frame as a rigid transformation. Use inverseCoordinatesOf() (resp. coordinatesOf()) to apply the transformation (resp. its inverse). Note the inversion.
Hierarchy of Frames
The position and the orientation of a Frame are actually defined with respect to a referenceFrame(). The default referenceFrame() is the world coordinate system (represented by a NULL
referenceFrame()). If you setReferenceFrame() to a different Frame, you must then differentiate:
- the local translation() and rotation(), defined with respect to the referenceFrame(),
- the global position() and orientation(), always defined with respect to the world coordinate system.
A Frame is actually defined by its translation() with respect to its referenceFrame(), and then by a rotation() of the coordinate system around the new translated origin.
This terminology for local (translation() and rotation()) and global (position() and orientation()) definitions is used in all the methods' names and should be sufficient to prevent ambiguities. These notions are obviously identical when the referenceFrame() is NULL
, i.e. when the Frame is defined in the world coordinate system (the one you are in at the beginning of the QGLViewer::draw() method, see the introduction page).
Frames can hence easily be organized in a tree hierarchy, which root is the world coordinate system. A loop in the hierarchy would result in an inconsistent (multiple) Frame definition. settingAsReferenceFrameWillCreateALoop() checks this and prevents setReferenceFrame() from creating such a loop.
This frame hierarchy is used in methods like coordinatesOfIn(), coordinatesOfFrom()... which allow coordinates (or vector) conversions from a Frame to any other one (including the world coordinate system).
However, one must note that this hierarchical representation is internal to the Frame classes. When the Frames represent OpenGL coordinates system, one should map this hierarchical representation to the OpenGL GL_MODELVIEW matrix stack. See the matrix() documentation for details.
Constraints
An interesting feature of Frames is that their displacements can be constrained. When a Constraint is attached to a Frame, it filters the input of translate() and rotate(), and only the resulting filtered motion is applied to the Frame. The default constraint() is NULL
resulting in no filtering. Use setConstraint() to attach a Constraint to a frame.
Constraints are especially usefull for the ManipulatedFrame instances, in order to forbid some mouse motions. See the constrainedFrame, constrainedCamera and luxo examples for an illustration.
Classical constraints are provided for convenience (see LocalConstraint, WorldConstraint and CameraConstraint) and new constraints can very easily be implemented.
Derived classes
The ManipulatedFrame class inherits Frame and implements a mouse motion convertion, so that a Frame (and hence an object) can be manipulated in the scene with the mouse.
Constructor & Destructor Documentation
Frame | ( | ) |
Creates a default Frame.
Its position() is (0,0,0) and it has an identity orientation() Quaternion. The referenceFrame() and the constraint() are NULL
.
Copy constructor.
The translation() and rotation() as well as constraint() and referenceFrame() pointers are copied.
Frame | ( | const Vec & | position, |
const Quaternion & | orientation | ||
) |
Creates a Frame with a position() and an orientation().
See the Vec and Quaternion documentations for convenient constructors and methods.
The Frame is defined in the world coordinate system (its referenceFrame() is NULL
). It has a NULL
associated constraint().
Member Function Documentation
void alignWithFrame | ( | const Frame *const | frame, |
bool | move = false , |
||
float | threshold = 0.0f |
||
) |
Aligns the Frame with frame
, so that two of their axis are parallel.
If one of the X, Y and Z axis of the Frame is almost parallel to any of the X, Y, or Z axis of frame
, the Frame is rotated so that these two axis actually become parallel.
If, after this first rotation, two other axis are also almost parallel, a second alignment is performed. The two frames then have identical orientations, up to 90 degrees rotations.
threshold
measures how close two axis must be to be considered parallel. It is compared with the absolute values of the dot product of the normalized axis. As a result, useful range is sqrt(2)/2 (systematic alignment) to 1 (no alignment).
When move
is set to true
, the Frame position() is also affected by the alignment. The new Frame's position() is such that the frame
position (computed with coordinatesOf(), in the Frame coordinates system) does not change.
frame
may be NULL
and then represents the world coordinate system (same convention than for the referenceFrame()).
The rotation (and translation when move
is true
) applied to the Frame are filtered by the possible constraint().
Definition at line 1055 of file frame.cpp.
References Frame::coordinatesOf(), Frame::inverse(), Frame::inverseTransformOf(), max(), Vec::norm(), Frame::orientation(), Frame::position(), Frame::rotate(), Frame::rotation(), Frame::translate(), and Frame::translation().
Referenced by ManipulatedFrame::mouseDoubleClickEvent().
|
inline |
Returns the current constraint applied to the Frame.
A NULL
value (default) means that no Constraint is used to filter Frame translation and rotation. See the Constraint class documentation for details.
You may have to use a dynamic_cast
to convert the result to a Constraint derived class.
Definition at line 356 of file frame.h.
Referenced by Frame::operator=(), RenderWorld::resourceChanged(), Frame::rotate(), Frame::rotateAroundPoint(), Frame::setRotationWithConstraint(), Frame::setTranslationAndRotationWithConstraint(), Frame::setTranslationWithConstraint(), ManipulatedFrame::startAction(), and Frame::translate().
Returns the Frame coordinates of a point src
defined in the world coordinate system (converts from world to Frame).
inverseCoordinatesOf() performs the inverse convertion. transformOf() converts 3D vectors instead of 3D coordinates.
See the frameTransform example for an illustration.
Definition at line 702 of file frame.cpp.
References Frame::localCoordinatesOf(), and Frame::referenceFrame().
Referenced by Frame::alignWithFrame(), Camera::cameraCoordinatesOf(), Frame::coordinatesOfIn(), Frame::getCoordinatesOf(), ManipulatedCameraFrame::mouseMoveEvent(), ManipulatedFrame::mouseMoveEvent(), Frame::setPosition(), Frame::setPositionAndOrientation(), Frame::setPositionAndOrientationWithConstraint(), Frame::setPositionWithConstraint(), and Camera::unprojectedCoordinatesOf().
Returns the Frame coordinates of the point whose position in the from
coordinate system is src
(converts from from
to Frame).
coordinatesOfIn() performs the inverse transformation.
Definition at line 749 of file frame.cpp.
References Frame::inverseCoordinatesOf(), Frame::localCoordinatesOf(), and Frame::referenceFrame().
Referenced by Frame::getCoordinatesOfFrom().
Returns the in
coordinates of the point whose position in the Frame coordinate system is src
(converts from Frame to in
).
coordinatesOfFrom() performs the inverse transformation.
Definition at line 764 of file frame.cpp.
References Frame::coordinatesOf(), Frame::localInverseCoordinatesOf(), and Frame::referenceFrame().
Referenced by Frame::getCoordinatesOfIn().
|
virtual |
Returns an XML QDomElement
that represents the Frame.
name
is the name of the QDomElement tag. doc
is the QDomDocument
factory used to create QDomElement.
The resulting QDomElement looks like:
Use initFromDOMElement() to restore the Frame state from the resulting QDomElement
.
See Vec::domElement() for a complete example. See also Quaternion::domElement(), Camera::domElement()...
- Attention
- The constraint() and referenceFrame() are not saved in the QDomElement.
Reimplemented in ManipulatedFrame, and ManipulatedCameraFrame.
Definition at line 994 of file frame.cpp.
References Frame::orientation(), and Frame::position().
Referenced by ManipulatedFrame::domElement(), and KeyFrameInterpolator::domElement().
void getCoordinatesOf | ( | const float | src[3], |
float | res[3] | ||
) | const |
Same as coordinatesOf(), but with float
parameters.
Definition at line 785 of file frame.cpp.
References Frame::coordinatesOf().
void getCoordinatesOfFrom | ( | const float | src[3], |
float | res[3], | ||
const Frame *const | from | ||
) | const |
Same as coordinatesOfFrom(), but with float
parameters.
Definition at line 825 of file frame.cpp.
References Frame::coordinatesOfFrom().
void getCoordinatesOfIn | ( | const float | src[3], |
float | res[3], | ||
const Frame *const | in | ||
) | const |
Same as coordinatesOfIn(), but with float
parameters.
Definition at line 817 of file frame.cpp.
References Frame::coordinatesOfIn().
void getInverseCoordinatesOf | ( | const float | src[3], |
float | res[3] | ||
) | const |
Same as inverseCoordinatesOf(), but with float
parameters.
Definition at line 793 of file frame.cpp.
References Frame::inverseCoordinatesOf().
void getInverseTransformOf | ( | const float | src[3], |
float | res[3] | ||
) | const |
Same as inverseTransformOf(), but with float
parameters.
Definition at line 934 of file frame.cpp.
References Frame::inverseTransformOf().
void getLocalCoordinatesOf | ( | const float | src[3], |
float | res[3] | ||
) | const |
Same as localCoordinatesOf(), but with float
parameters.
Definition at line 801 of file frame.cpp.
References Frame::localCoordinatesOf().
void getLocalInverseCoordinatesOf | ( | const float | src[3], |
float | res[3] | ||
) | const |
Same as localInverseCoordinatesOf(), but with float
parameters.
Definition at line 809 of file frame.cpp.
References Frame::localInverseCoordinatesOf().
void getLocalInverseTransformOf | ( | const float | src[3], |
float | res[3] | ||
) | const |
Same as localInverseTransformOf(), but with float
parameters.
Definition at line 950 of file frame.cpp.
References Frame::localInverseTransformOf().
void getLocalTransformOf | ( | const float | src[3], |
float | res[3] | ||
) | const |
Same as localTransformOf(), but with float
parameters.
Definition at line 942 of file frame.cpp.
References Frame::localTransformOf().
void getMatrix | ( | GLdouble | m[4][4] | ) | const |
GLdouble
[4][4] version of matrix().
See also getWorldMatrix() and matrix().
Definition at line 131 of file frame.cpp.
References Quaternion::getMatrix().
Referenced by Frame::matrix().
void getMatrix | ( | GLdouble | m[16] | ) | const |
GLdouble
[16] version of matrix().
See also getWorldMatrix() and matrix().
Definition at line 141 of file frame.cpp.
References Quaternion::getMatrix().
void getOrientation | ( | double & | q0, |
double & | q1, | ||
double & | q2, | ||
double & | q3 | ||
) | const |
Get the current orientation of the frame (same as orientation()).
Parameters are the orientation Quaternion values. See also setOrientation().
The \p q are set to the orientation() of the Frame.
See Quaternion::Quaternion(double, double, double, double) for details on q
.
Definition at line 526 of file frame.cpp.
References Frame::orientation().
void getPosition | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const |
x
, y
and z
are set to the position() of the Frame.
Definition at line 492 of file frame.cpp.
References Frame::position().
Referenced by RenderWorld::draw().
void getRotation | ( | double & | q0, |
double & | q1, | ||
double & | q2, | ||
double & | q3 | ||
) | const |
The q
are set to the rotation() of the Frame.
See Quaternion::Quaternion(double, double, double, double) for details on q
.
Definition at line 308 of file frame.cpp.
References Frame::rotation().
void getTransformOf | ( | const float | src[3], |
float | res[3] | ||
) | const |
Same as transformOf(), but with float
parameters.
Definition at line 926 of file frame.cpp.
References Frame::transformOf().
void getTransformOfFrom | ( | const float | src[3], |
float | res[3], | ||
const Frame *const | from | ||
) | const |
Same as transformOfFrom(), but with float
parameters.
Definition at line 966 of file frame.cpp.
References Frame::transformOfFrom().
void getTransformOfIn | ( | const float | src[3], |
float | res[3], | ||
const Frame *const | in | ||
) | const |
Same as transformOfIn(), but with float
parameters.
Definition at line 958 of file frame.cpp.
References Frame::transformOfIn().
void getTranslation | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const |
Fill x
, y
and z
with the translation() of the Frame.
Definition at line 291 of file frame.cpp.
References Frame::translation().
void getWorldMatrix | ( | GLdouble | m[4][4] | ) | const |
float[4][4] parameter version of worldMatrix().
See also getMatrix() and matrix().
Definition at line 211 of file frame.cpp.
References Frame::worldMatrix().
void getWorldMatrix | ( | GLdouble | m[16] | ) | const |
float[16] parameter version of worldMatrix().
See also getMatrix() and matrix().
Definition at line 220 of file frame.cpp.
References Frame::worldMatrix().
|
virtualslot |
Restores the Frame state from a QDomElement
created by domElement().
See domElement() for the QDomElement
syntax. See the Vec::initFromDOMElement() and Quaternion::initFromDOMElement() documentations for details on default values if an argument is missing.
- Attention
- The constraint() and referenceFrame() are not restored by this method and are left unchanged.
Definition at line 1011 of file frame.cpp.
References Quaternion::normalized(), Frame::setOrientation(), and Frame::setPosition().
Referenced by ManipulatedFrame::initFromDOMElement(), and KeyFrameInterpolator::initFromDOMElement().
|
signal |
This signal is emitted when the Frame is interpolated by a KeyFrameInterpolator.
See the KeyFrameInterpolator documentation for details.
If a KeyFrameInterpolator is used to successively interpolate several Frames in your scene, connect the KeyFrameInterpolator::interpolated() signal instead (identical, but independent of the interpolated Frame).
Frame inverse | ( | ) | const |
Returns a Frame representing the inverse of the Frame space transformation.
The rotation() of the new Frame is the Quaternion::inverse() of the original rotation. Its translation() is the negated inverse rotated image of the original translation.
If a Frame is considered as a space rigid transformation (translation and rotation), the inverse() Frame performs the inverse transformation.
Only the local Frame transformation (i.e. defined with respect to the referenceFrame()) is inverted. Use worldInverse() for a global inverse.
The resulting Frame has the same referenceFrame() as the Frame and a NULL
constraint().
- Note
- The scaling factor of the 4x4 matrix is 1.0.
Definition at line 164 of file frame.cpp.
References Quaternion::inverse(), Quaternion::inverseRotate(), Frame::referenceFrame(), and Frame::setReferenceFrame().
Referenced by Frame::alignWithFrame(), and Frame::setOrientation().
Returns the world coordinates of the point whose position in the Frame coordinate system is src
(converts from Frame to world).
coordinatesOf() performs the inverse convertion. Use inverseTransformOf() to transform 3D vectors instead of 3D coordinates.
Definition at line 715 of file frame.cpp.
References Frame::localInverseCoordinatesOf(), and Frame::referenceFrame().
Referenced by Frame::coordinatesOfFrom(), Frame::getInverseCoordinatesOf(), Frame::position(), Camera::projectedCoordinatesOf(), and Camera::worldCoordinatesOf().
Returns the world transform of the vector whose coordinates in the Frame coordinate system is src
(converts vectors from Frame to world).
transformOf() performs the inverse transformation. Use inverseCoordinatesOf() to transform 3D coordinates instead of 3D vectors.
Definition at line 856 of file frame.cpp.
References Frame::localInverseTransformOf(), and Frame::referenceFrame().
Referenced by Frame::alignWithFrame(), CameraConstraint::constrainTranslation(), MyCameraConstraint::constrainTranslation(), Frame::getInverseTransformOf(), ManipulatedCameraFrame::mouseMoveEvent(), ManipulatedFrame::mouseMoveEvent(), Camera::rightVector(), Frame::rotateAroundPoint(), Camera::setViewDirection(), Frame::transformOfFrom(), Camera::upVector(), Camera::viewDirection(), and ManipulatedCameraFrame::wheelEvent().
Returns the Frame coordinates of a point src
defined in the referenceFrame() coordinate system (converts from referenceFrame() to Frame).
localInverseCoordinatesOf() performs the inverse convertion. See also localTransformOf().
Definition at line 731 of file frame.cpp.
References Quaternion::inverseRotate(), Frame::rotation(), and Frame::translation().
Referenced by Frame::coordinatesOf(), Frame::coordinatesOfFrom(), and Frame::getLocalCoordinatesOf().
Returns the referenceFrame() coordinates of a point src
defined in the Frame coordinate system (converts from Frame to referenceFrame()).
localCoordinatesOf() performs the inverse convertion. See also localInverseTransformOf().
Definition at line 740 of file frame.cpp.
References Quaternion::rotate(), Frame::rotation(), and Frame::translation().
Referenced by Frame::coordinatesOfIn(), Frame::getLocalInverseCoordinatesOf(), and Frame::inverseCoordinatesOf().
Returns the referenceFrame() transform of a vector src
defined in the Frame coordinate system (converts vectors from Frame to referenceFrame()).
localTransformOf() performs the inverse transformation. See also localInverseCoordinatesOf().
Definition at line 881 of file frame.cpp.
References Quaternion::rotate(), and Frame::rotation().
Referenced by Frame::getLocalInverseTransformOf(), Frame::inverseTransformOf(), and Frame::transformOfIn().
Returns the Frame transform of a vector src
defined in the referenceFrame() coordinate system (converts vectors from referenceFrame() to Frame).
localInverseTransformOf() performs the inverse transformation. See also localCoordinatesOf().
Definition at line 872 of file frame.cpp.
References Quaternion::inverseRotate(), and Frame::rotation().
Referenced by Frame::getLocalTransformOf(), Frame::transformOf(), and Frame::transformOfFrom().
const GLdouble * matrix | ( | ) | const |
Returns the 4x4 OpenGL transformation matrix represented by the Frame.
This method should be used in conjunction with glMultMatrixd()
to modify the OpenGL modelview matrix from a Frame hierarchy. With this Frame hierarchy:
The associated OpenGL drawing code should look like:
Note the use of nested glPushMatrix()
and glPopMatrix()
blocks to represent the frame hierarchy: leftArm
and rightArm
are both correctly drawn with respect to the body
coordinate system.
This matrix only represents the local Frame transformation (i.e. with respect to the referenceFrame()). Use worldMatrix() to get the full Frame transformation matrix (i.e. from the world to the Frame coordinate system). These two match when the referenceFrame() is NULL
.
The result is only valid until the next call to matrix(), getMatrix(), worldMatrix() or getWorldMatrix(). Use it immediately (as above) or use getMatrix() instead.
- Attention
- The OpenGL format of the result is the transpose of the actual mathematical European representation (translation is on the last line instead of the last column).
- Note
- The scaling factor of the 4x4 matrix is 1.0.
Definition at line 123 of file frame.cpp.
References Frame::getMatrix().
Referenced by QGLViewer::drawLight(), KeyFrameInterpolator::drawPath(), and Frame::worldMatrix().
|
signal |
This signal is emitted whenever the position() or the orientation() of the Frame is modified.
Connect this signal to any object that must be notified:
Use the QGLViewer::QGLViewerPool() to connect the signal to all the viewers.
- Note
- If your Frame is part of a Frame hierarchy (see referenceFrame()), a modification of one of the parents of this Frame will not emit this signal. Use code like this to change this behavior (you can do this recursively for all the referenceFrame() until the
NULL
world root frame is encountered):
- Attention
- Connecting this signal to a QGLWidget::update() slot (or a method that calls it) will prevent you from modifying the Frame inside your QGLViewer::draw() method as it would result in an infinite loop. However, QGLViewer::draw() should not modify the scene.
- Note
- Note that this signal might be emitted even if the Frame is not actually modified, for instance after a translate(Vec(0,0,0)) or a setPosition(position()).
Referenced by Frame::rotate(), Frame::rotateAroundPoint(), Frame::setFromMatrix(), Frame::setPositionAndOrientation(), Frame::setReferenceFrame(), Frame::setTranslationAndRotation(), Frame::setTranslationAndRotationWithConstraint(), and Frame::translate().
Equal operator.
The referenceFrame() and constraint() pointers are copied.
- Attention
- Signal and slot connections are not copied.
Definition at line 54 of file frame.cpp.
References Frame::constraint(), Frame::referenceFrame(), Frame::rotation(), Frame::setConstraint(), Frame::setReferenceFrame(), Frame::setTranslationAndRotation(), and Frame::translation().
Referenced by ManipulatedFrame::operator=().
Quaternion orientation | ( | ) | const |
Returns the orientation of the Frame, defined in the world coordinate system.
See also position(), setOrientation() and rotation().
Definition at line 546 of file frame.cpp.
References Frame::referenceFrame(), and Frame::rotation().
Referenced by Frame::alignWithFrame(), Camera::computeModelViewMatrix(), Frame::domElement(), Frame::getOrientation(), ManipulatedFrame::mouseMoveEvent(), Camera::orientation(), Frame::setOrientation(), Frame::setOrientationWithConstraint(), Frame::setPositionAndOrientation(), Frame::setPositionAndOrientationWithConstraint(), and Frame::worldMatrix().
Vec position | ( | ) | const |
Returns the position of the Frame, defined in the world coordinate system.
See also orientation(), setPosition() and translation().
Definition at line 537 of file frame.cpp.
References Frame::inverseCoordinatesOf().
Referenced by Frame::alignWithFrame(), ManipulatedFrame::checkIfGrabsMouse(), MyCameraConstraint::constrainTranslation(), Frame::domElement(), KeyFrameInterpolator::drawPath(), QGLViewer::drawVisualHints(), Frame::getPosition(), ManipulatedFrame::mouseMoveEvent(), Camera::position(), Frame::projectOnLine(), Frame::rotateAroundPoint(), Frame::setPositionAndOrientation(), and Frame::worldMatrix().
Translates the Frame so that its position() lies on the line defined by origin
and direction
(defined in the world coordinate system).
Simply uses an orthogonal projection. direction
does not need to be normalized.
Definition at line 1133 of file frame.cpp.
References Frame::position(), Vec::projectOnAxis(), and Frame::translate().
Referenced by Camera::centerScene(), and ManipulatedFrame::mouseDoubleClickEvent().
|
inline |
Returns the reference Frame, in which coordinates system the Frame is defined.
The translation() and rotation() of the Frame are defined with respect to the referenceFrame() coordinate system. A NULL
referenceFrame() (default value) means that the Frame is defined in the world coordinate system.
Use position() and orientation() to recursively convert values along the referenceFrame() chain and to get values expressed in the world coordinate system. The values match when the referenceFrame() is NULL
.
Use setReferenceFrame() to set this value and create a Frame hierarchy. Convenient functions allow you to convert 3D coordinates from one Frame to an other: see coordinatesOf(), localCoordinatesOf(), coordinatesOfIn() and their inverse functions.
Vectors can also be converted using transformOf(), transformOfIn, localTransformOf() and their inverse functions.
Definition at line 262 of file frame.h.
Referenced by WorldConstraint::constrainTranslation(), CameraConstraint::constrainTranslation(), MyCameraConstraint::constrainTranslation(), Frame::coordinatesOf(), Frame::coordinatesOfFrom(), Frame::coordinatesOfIn(), Frame::inverse(), Frame::inverseCoordinatesOf(), Frame::inverseTransformOf(), ManipulatedFrame::mouseMoveEvent(), Frame::operator=(), Frame::orientation(), Frame::setOrientation(), Frame::setOrientationWithConstraint(), Frame::setPosition(), Frame::setPositionAndOrientation(), Frame::setPositionAndOrientationWithConstraint(), Frame::setPositionWithConstraint(), Frame::settingAsReferenceFrameWillCreateALoop(), Frame::transformOf(), Frame::transformOfFrom(), Frame::transformOfIn(), and Frame::worldMatrix().
void rotate | ( | Quaternion & | q | ) |
Same as rotate(const Quaternion&) but q
may be modified to satisfy the rotation constraint().
Its new value corresponds to the rotation that has actually been applied to the Frame.
Definition at line 376 of file frame.cpp.
References Constraint::constrainRotation(), Frame::constraint(), Frame::modified(), and Quaternion::normalize().
Referenced by Frame::alignWithFrame(), ManipulatedCameraFrame::mouseMoveEvent(), Frame::rotate(), Frame::rotateAroundPoint(), Camera::setUpVector(), and ManipulatedFrame::spin().
void rotate | ( | const Quaternion & | q | ) |
Rotates the Frame by q
(defined in the Frame coordinate system): R = R*q.
The rotation actually applied to the Frame may differ from q
since it can be filtered by the constraint(). Use rotate(Quaternion&) or setRotationWithConstraint() to retrieve the filtered rotation value. Use setRotation() to directly rotate the Frame without taking the constraint() into account.
See also translate(const Vec&). Emits the modified() signal.
Definition at line 368 of file frame.cpp.
References Frame::rotate().
void rotate | ( | double | q0, |
double | q1, | ||
double | q2, | ||
double | q3 | ||
) |
Same as rotate(const Quaternion&) but with float
Quaternion parameters.
Definition at line 397 of file frame.cpp.
References Frame::rotate().
void rotate | ( | double & | q0, |
double & | q1, | ||
double & | q2, | ||
double & | q3 | ||
) |
Same as rotate(Quaternion&) but with float
Quaternion parameters.
Definition at line 386 of file frame.cpp.
References Frame::rotate().
void rotateAroundPoint | ( | Quaternion & | rotation, |
const Vec & | point | ||
) |
Makes the Frame rotate() by rotation
around point
.
point
is defined in the world coordinate system, while the rotation
axis is defined in the Frame coordinate system.
If the Frame has a constraint(), rotation
is first constrained using Constraint::constrainRotation(). The translation which results from the filtered rotation around point
is then computed and filtered using Constraint::constrainTranslation(). The new rotation
value corresponds to the rotation that has actually been applied to the Frame.
Emits the modified() signal.
Definition at line 414 of file frame.cpp.
References Quaternion::angle(), Quaternion::axis(), Constraint::constrainRotation(), Frame::constraint(), Constraint::constrainTranslation(), Frame::inverseTransformOf(), Frame::modified(), Quaternion::normalize(), Frame::position(), Frame::rotate(), and Frame::rotation().
Referenced by Frame::rotateAroundPoint(), and ManipulatedCameraFrame::spin().
void rotateAroundPoint | ( | const Quaternion & | rotation, |
const Vec & | point | ||
) |
Same as rotateAroundPoint(), but with a const
rotation
Quaternion.
Note that the actual rotation may differ since it can be filtered by the constraint().
Definition at line 429 of file frame.cpp.
References Frame::rotateAroundPoint(), and Frame::rotation().
|
inline |
Returns the Frame rotation, defined with respect to the referenceFrame().
Use orientation() to get the result in the world coordinates. These two values are identical when the referenceFrame() is NULL
(default).
See also setRotation() and setRotationWithConstraint().
Returns the current Quaternion orientation. See setRotation().
Definition at line 237 of file frame.h.
Referenced by Frame::alignWithFrame(), LocalConstraint::constrainTranslation(), Frame::getRotation(), Frame::localCoordinatesOf(), Frame::localInverseCoordinatesOf(), Frame::localInverseTransformOf(), Frame::localTransformOf(), Frame::operator=(), Frame::orientation(), Frame::rotateAroundPoint(), Frame::setRotationWithConstraint(), Frame::setTranslationAndRotation(), and Frame::setTranslationAndRotationWithConstraint().
|
inline |
Sets the constraint() attached to the Frame.
A NULL
value means no constraint. The previous constraint() should be deleted by the calling method if needed.
Definition at line 361 of file frame.h.
Referenced by RenderWorld::init(), ManipulatedFrame::mouseReleaseEvent(), Frame::operator=(), ManipulatedFrame::startAction(), ManipulatedCameraFrame::wheelEvent(), and ManipulatedFrame::wheelEvent().
void setFromMatrix | ( | const GLdouble | m[4][4] | ) |
This is an overloaded method provided for convenience.
Same as setFromMatrix().
Definition at line 228 of file frame.cpp.
References Frame::modified().
Referenced by Frame::setFromMatrix().
void setFromMatrix | ( | const GLdouble | m[16] | ) |
Sets the Frame from an OpenGL matrix representation (rotation in the upper left 3x3 matrix and translation on the last line).
Hence, if a code fragment looks like:
It is equivalent to write:
Using this conversion, you can benefit from the powerful Frame transformation methods to translate points and vectors to and from the Frame coordinate system to any other Frame coordinate system (including the world coordinate system). See coordinatesOf() and transformOf().
Emits the modified() signal. See also matrix(), getMatrix() and Quaternion::setFromRotationMatrix().
- Attention
- A Frame does not contain a scale factor. The possible scaling in
m
will not be converted into the Frame by this method.
Definition at line 272 of file frame.cpp.
References Frame::setFromMatrix().
void setOrientation | ( | const Quaternion & | orientation | ) |
Sets the orientation() of the Frame, defined in the world coordinate system.
Emits the modified() signal.
Use setRotation() to define the local frame rotation (with respect to the referenceFrame()). The potential constraint() of the Frame is not taken into account, use setOrientationWithConstraint() instead.
Definition at line 505 of file frame.cpp.
References Frame::inverse(), Frame::orientation(), Frame::referenceFrame(), and Frame::setRotation().
Referenced by KeyFrameInterpolator::drawPath(), Frame::initFromDOMElement(), Camera::interpolateToFitScene(), Camera::interpolateToZoomOnPixel(), Camera::operator=(), Camera::setOrientation(), and Frame::setOrientation().
void setOrientation | ( | double | q0, |
double | q1, | ||
double | q2, | ||
double | q3 | ||
) |
Same as setOrientation(), but with float
parameters.
Definition at line 514 of file frame.cpp.
References Frame::setOrientation().
void setOrientationWithConstraint | ( | Quaternion & | orientation | ) |
Same as setOrientation(), but orientation
is modified so that the potential constraint() of the Frame is satisfied.
See also setPositionWithConstraint() and setRotationWithConstraint().
Definition at line 631 of file frame.cpp.
References Quaternion::inverse(), Frame::orientation(), Frame::referenceFrame(), and Frame::setRotationWithConstraint().
Referenced by Camera::setViewDirection().
void setPosition | ( | const Vec & | position | ) |
Sets the position() of the Frame, defined in the world coordinate system.
Emits the modified() signal.
Use setTranslation() to define the local frame translation (with respect to the referenceFrame()). The potential constraint() of the Frame is not taken into account, use setPositionWithConstraint() instead.
Definition at line 443 of file frame.cpp.
References Frame::coordinatesOf(), Frame::referenceFrame(), and Frame::setTranslation().
Referenced by KeyFrameInterpolator::drawPath(), Frame::initFromDOMElement(), Camera::interpolateToFitScene(), Camera::interpolateToZoomOnPixel(), Camera::operator=(), Camera::setPosition(), Frame::setPosition(), and Camera::setUpVector().
void setPosition | ( | float | x, |
float | y, | ||
float | z | ||
) |
Same as setPosition(), but with float
parameters.
Definition at line 452 of file frame.cpp.
References Frame::setPosition().
void setPositionAndOrientation | ( | const Vec & | position, |
const Quaternion & | orientation | ||
) |
Same as successive calls to setPosition() and then setOrientation().
Only one modified() signal is emitted, which is convenient if this signal is connected to a QGLViewer::update() slot. See also setTranslationAndRotation() and setPositionAndOrientationWithConstraint().
Definition at line 462 of file frame.cpp.
References Frame::coordinatesOf(), Quaternion::inverse(), Frame::modified(), Frame::orientation(), Frame::position(), and Frame::referenceFrame().
void setPositionAndOrientationWithConstraint | ( | Vec & | position, |
Quaternion & | orientation | ||
) |
Same as setPositionAndOrientation() but position
and orientation
are modified to satisfy the constraint.
Emits the modified() signal.
Definition at line 641 of file frame.cpp.
References Frame::coordinatesOf(), Quaternion::inverse(), Frame::orientation(), Frame::referenceFrame(), and Frame::setTranslationAndRotationWithConstraint().
Referenced by KeyFrameInterpolator::interpolateAtTime().
void setPositionWithConstraint | ( | Vec & | position | ) |
Same as setPosition(), but position
is modified so that the potential constraint() of the Frame is satisfied.
See also setOrientationWithConstraint() and setTranslationWithConstraint().
Definition at line 621 of file frame.cpp.
References Frame::coordinatesOf(), Frame::referenceFrame(), and Frame::setTranslationWithConstraint().
Referenced by Camera::fitScreenRegion(), and Camera::fitSphere().
void setReferenceFrame | ( | const Frame *const | refFrame | ) |
Sets the referenceFrame() of the Frame.
The Frame translation() and rotation() are then defined in the referenceFrame() coordinate system. Use position() and orientation() to express these in the world coordinate system.
Emits the modified() signal if refFrame
differs from the current referenceFrame().
Using this method, you can create a hierarchy of Frames. This hierarchy needs to be a tree, which root is the world coordinate system (i.e. a NULL
referenceFrame()). A warning is printed and no action is performed if setting refFrame
as the referenceFrame() would create a loop in the Frame hierarchy (see settingAsReferenceFrameWillCreateALoop()).
Definition at line 665 of file frame.cpp.
References Frame::modified(), and Frame::settingAsReferenceFrameWillCreateALoop().
Referenced by Frame::inverse(), Camera::operator=(), and Frame::operator=().
|
inline |
Set the current rotation Quaternion.
See rotation() and the different Quaternion constructors. Emits the modified() signal. See also setTranslation() and setRotationWithConstraint().
Sets the rotation() of the Frame, locally defined with respect to the referenceFrame(). Emits the modified() signal.
Use setOrientation() to define the world coordinates orientation(). The potential constraint() of the Frame is not taken into account, use setRotationWithConstraint() instead.
Definition at line 215 of file frame.h.
Referenced by Frame::setOrientation(), Frame::setRotation(), Frame::setRotationWithConstraint(), and Frame::worldMatrix().
void setRotation | ( | double | q0, |
double | q1, | ||
double | q2, | ||
double | q3 | ||
) |
Same as setRotation() but with float
Quaternion parameters.
Definition at line 300 of file frame.cpp.
References Frame::setRotation().
void setRotationWithConstraint | ( | Quaternion & | rotation | ) |
Same as setRotation(), but rotation
is modified so that the potential constraint() of the Frame is satisfied.
Emits the modified() signal. See also setTranslationWithConstraint() and setOrientationWithConstraint().
Definition at line 579 of file frame.cpp.
References Constraint::constrainRotation(), Frame::constraint(), Quaternion::inverse(), Quaternion::normalize(), Frame::rotation(), and Frame::setRotation().
Referenced by Frame::setOrientationWithConstraint().
bool settingAsReferenceFrameWillCreateALoop | ( | const Frame *const | frame | ) |
Returns true
if setting frame
as the Frame's referenceFrame() would create a loop in the Frame hierarchy.
Definition at line 680 of file frame.cpp.
References Frame::referenceFrame().
Referenced by Frame::setReferenceFrame().
|
inline |
Sets the translation() of the frame, locally defined with respect to the referenceFrame().
Emits the modified() signal.
Use setPosition() to define the world coordinates position(). Use setTranslationWithConstraint() to take into account the potential constraint() of the Frame.
Definition at line 201 of file frame.h.
Referenced by Frame::setPosition(), Frame::setTranslation(), Frame::setTranslationWithConstraint(), and Frame::worldMatrix().
void setTranslation | ( | float | x, |
float | y, | ||
float | z | ||
) |
Same as setTranslation(), but with float
parameters.
Definition at line 285 of file frame.cpp.
References Frame::setTranslation().
void setTranslationAndRotation | ( | const Vec & | translation, |
const Quaternion & | rotation | ||
) |
Same as successive calls to setTranslation() and then setRotation().
Only one modified() signal is emitted, which is convenient if this signal is connected to a QGLViewer::update() slot. See also setPositionAndOrientation() and setTranslationAndRotationWithConstraint().
Definition at line 483 of file frame.cpp.
References Frame::modified(), Frame::rotation(), and Frame::translation().
Referenced by Frame::operator=().
void setTranslationAndRotationWithConstraint | ( | Vec & | translation, |
Quaternion & | rotation | ||
) |
Same as setTranslationAndRotation(), but translation
and orientation
are modified to satisfy the constraint().
Emits the modified() signal.
Definition at line 595 of file frame.cpp.
References Constraint::constrainRotation(), Frame::constraint(), Constraint::constrainTranslation(), Quaternion::inverse(), Frame::modified(), Quaternion::normalize(), Frame::rotation(), and Frame::translation().
Referenced by Frame::setPositionAndOrientationWithConstraint().
void setTranslationWithConstraint | ( | Vec & | translation | ) |
Same as setTranslation(), but translation
is modified so that the potential constraint() of the Frame is satisfied.
Emits the modified() signal. See also setRotationWithConstraint() and setPositionWithConstraint().
Definition at line 565 of file frame.cpp.
References Frame::constraint(), Constraint::constrainTranslation(), Frame::setTranslation(), and Frame::translation().
Referenced by Frame::setPositionWithConstraint().
Returns the Frame transform of a vector src
defined in the world coordinate system (converts vectors from world to Frame).
inverseTransformOf() performs the inverse transformation. coordinatesOf() converts 3D coordinates instead of 3D vectors (here only the rotational part of the transformation is taken into account).
See the frameTransform example for an illustration.
Definition at line 843 of file frame.cpp.
References Frame::localTransformOf(), and Frame::referenceFrame().
Referenced by WorldConstraint::constrainRotation(), CameraConstraint::constrainRotation(), WorldConstraint::constrainTranslation(), CameraConstraint::constrainTranslation(), Frame::getTransformOf(), ManipulatedCameraFrame::mouseMoveEvent(), ManipulatedFrame::mouseMoveEvent(), ManipulatedCameraFrame::startAction(), and Frame::transformOfIn().
Returns the Frame transform of the vector whose coordinates in the from
coordinate system is src
(converts vectors from from
to Frame).
transformOfIn() performs the inverse transformation.
Definition at line 890 of file frame.cpp.
References Frame::inverseTransformOf(), Frame::localTransformOf(), and Frame::referenceFrame().
Referenced by Frame::getTransformOfFrom().
Returns the in
transform of the vector whose coordinates in the Frame coordinate system is src
(converts vectors from Frame to in
).
transformOfFrom() performs the inverse transformation.
Definition at line 905 of file frame.cpp.
References Frame::localInverseTransformOf(), Frame::referenceFrame(), and Frame::transformOf().
Referenced by Frame::getTransformOfIn().
void translate | ( | Vec & | t | ) |
Same as translate(const Vec&) but t
may be modified to satisfy the translation constraint().
Its new value corresponds to the translation that has actually been applied to the Frame.
Definition at line 335 of file frame.cpp.
References Frame::constraint(), Constraint::constrainTranslation(), and Frame::modified().
Referenced by Frame::alignWithFrame(), ManipulatedCameraFrame::mouseMoveEvent(), ManipulatedFrame::mouseMoveEvent(), Frame::projectOnLine(), Frame::translate(), and ManipulatedCameraFrame::wheelEvent().
void translate | ( | const Vec & | t | ) |
Translates the Frame of t
(defined in the Frame coordinate system).
The translation actually applied to the Frame may differ from t
since it can be filtered by the constraint(). Use translate(Vec&) or setTranslationWithConstraint() to retrieve the filtered translation value. Use setTranslation() to directly translate the Frame without taking the constraint() into account.
See also rotate(const Quaternion&). Emits the modified() signal.
Definition at line 327 of file frame.cpp.
References Frame::translate().
void translate | ( | float | x, |
float | y, | ||
float | z | ||
) |
Same as translate(const Vec&) but with float
parameters.
Definition at line 344 of file frame.cpp.
References Frame::translate().
void translate | ( | float & | x, |
float & | y, | ||
float & | z | ||
) |
Same as translate(Vec&) but with float
parameters.
Definition at line 351 of file frame.cpp.
References Frame::translate().
|
inline |
Returns the Frame translation, defined with respect to the referenceFrame().
Use position() to get the result in the world coordinates. These two values are identical when the referenceFrame() is NULL
(default).
See also setTranslation() and setTranslationWithConstraint().
Definition at line 228 of file frame.h.
Referenced by Frame::alignWithFrame(), Frame::getTranslation(), Frame::localCoordinatesOf(), Frame::localInverseCoordinatesOf(), Frame::operator=(), Frame::setTranslationAndRotation(), Frame::setTranslationAndRotationWithConstraint(), and Frame::setTranslationWithConstraint().
|
inline |
Returns the inverse() of the Frame world transformation.
The orientation() of the new Frame is the Quaternion::inverse() of the original orientation. Its position() is the negated and inverse rotated image of the original position.
The result Frame has a NULL
referenceFrame() and a NULL
constraint().
Use inverse() for a local (i.e. with respect to referenceFrame()) transformation inverse.
const GLdouble * worldMatrix | ( | ) | const |
Returns the 4x4 OpenGL transformation matrix represented by the Frame.
This method should be used in conjunction with glMultMatrixd()
to modify the OpenGL modelview matrix from a Frame:
This matrix represents the global Frame transformation: the entire referenceFrame() hierarchy is taken into account to define the Frame transformation from the world coordinate system. Use matrix() to get the local Frame transformation matrix (i.e. defined with respect to the referenceFrame()). These two match when the referenceFrame() is NULL
.
The OpenGL format of the result is the transpose of the actual mathematical European representation (translation is on the last line instead of the last column).
- Attention
- The result is only valid until the next call to matrix(), getMatrix(), worldMatrix() or getWorldMatrix(). Use it immediately (as above) or use getWorldMatrix() instead.
- Note
- The scaling factor of the 4x4 matrix is 1.0.
Definition at line 196 of file frame.cpp.
References Frame::matrix(), Frame::orientation(), Frame::position(), Frame::referenceFrame(), Frame::setRotation(), and Frame::setTranslation().
Referenced by Frame::getWorldMatrix().
The documentation for this class was generated from the following files: