23 #ifndef QGLVIEWER_FRAME_H
24 #define QGLVIEWER_FRAME_H
29 #include "constraint.h"
121 class QGLVIEWER_EXPORT
Frame :
public QObject
174 void setPosition(
const Vec& position);
175 void setPosition(
float x,
float y,
float z);
176 void setPositionWithConstraint(
Vec& position);
178 void setOrientation(
const Quaternion& orientation);
179 void setOrientation(
double q0,
double q1,
double q2,
double q3);
180 void setOrientationWithConstraint(
Quaternion& orientation);
182 void setPositionAndOrientation(
const Vec& position,
const Quaternion& orientation);
183 void setPositionAndOrientationWithConstraint(
Vec& position,
Quaternion& orientation);
185 Vec position()
const;
188 void getPosition(
float& x,
float& y,
float& z)
const;
189 void getOrientation(
double& q0,
double& q1,
double& q2,
double& q3)
const;
202 void setTranslation(
float x,
float y,
float z);
203 void setTranslationWithConstraint(
Vec& translation);
216 void setRotation(
double q0,
double q1,
double q2,
double q3);
217 void setRotationWithConstraint(
Quaternion& rotation);
219 void setTranslationAndRotation(
const Vec& translation,
const Quaternion& rotation);
220 void setTranslationAndRotationWithConstraint(
Vec& translation,
Quaternion& rotation);
239 void getTranslation(
float& x,
float& y,
float& z)
const;
240 void getRotation(
double& q0,
double& q1,
double& q2,
double& q3)
const;
263 void setReferenceFrame(
const Frame*
const refFrame);
264 bool settingAsReferenceFrameWillCreateALoop(
const Frame*
const frame);
270 void translate(
Vec& t);
271 void translate(
const Vec& t);
274 void translate(
float x,
float y,
float z);
275 void translate(
float& x,
float& y,
float& z);
281 void rotate(
double q0,
double q1,
double q2,
double q3);
282 void rotate(
double& q0,
double& q1,
double& q2,
double& q3);
284 void rotateAroundPoint(
Quaternion& rotation,
const Vec& point);
285 void rotateAroundPoint(
const Quaternion& rotation,
const Vec& point);
287 void alignWithFrame(
const Frame*
const frame,
bool move=
false,
float threshold=0.0f);
288 void projectOnLine(
const Vec& origin,
const Vec& direction);
294 Vec coordinatesOf(
const Vec& src)
const;
295 Vec inverseCoordinatesOf(
const Vec& src)
const;
296 Vec localCoordinatesOf(
const Vec& src)
const;
297 Vec localInverseCoordinatesOf(
const Vec& src)
const;
298 Vec coordinatesOfIn(
const Vec& src,
const Frame*
const in)
const;
299 Vec coordinatesOfFrom(
const Vec& src,
const Frame*
const from)
const;
301 void getCoordinatesOf(
const float src[3],
float res[3])
const;
302 void getInverseCoordinatesOf(
const float src[3],
float res[3])
const;
303 void getLocalCoordinatesOf(
const float src[3],
float res[3])
const;
304 void getLocalInverseCoordinatesOf(
const float src[3],
float res[3])
const;
305 void getCoordinatesOfIn(
const float src[3],
float res[3],
const Frame*
const in)
const;
306 void getCoordinatesOfFrom(
const float src[3],
float res[3],
const Frame*
const from)
const;
332 Vec transformOf(
const Vec& src)
const;
333 Vec inverseTransformOf(
const Vec& src)
const;
334 Vec localTransformOf(
const Vec& src)
const;
335 Vec localInverseTransformOf(
const Vec& src)
const;
336 Vec transformOfIn(
const Vec& src,
const Frame*
const in)
const;
337 Vec transformOfFrom(
const Vec& src,
const Frame*
const from)
const;
339 void getTransformOf(
const float src[3],
float res[3])
const;
340 void getInverseTransformOf(
const float src[3],
float res[3])
const;
341 void getLocalTransformOf(
const float src[3],
float res[3])
const;
342 void getLocalInverseTransformOf(
const float src[3],
float res[3])
const;
343 void getTransformOfIn(
const float src[3],
float res[3],
const Frame*
const in)
const;
344 void getTransformOfFrom(
const float src[3],
float res[3],
const Frame*
const from)
const;
367 const GLdouble* matrix()
const;
368 void getMatrix(GLdouble m[4][4])
const;
369 void getMatrix(GLdouble m[16])
const;
371 const GLdouble* worldMatrix()
const;
372 void getWorldMatrix(GLdouble m[4][4])
const;
373 void getWorldMatrix(GLdouble m[16])
const;
375 void setFromMatrix(
const GLdouble m[4][4]);
376 void setFromMatrix(
const GLdouble m[16]);
381 Frame inverse()
const;
396 virtual QDomElement domElement(
const QString& name, QDomDocument& document)
const;
398 virtual void initFromDOMElement(
const QDomElement& element);
410 const Frame* referenceFrame_;
415 #endif // QGLVIEWER_FRAME_H
Frame worldInverse() const
Returns the inverse() of the Frame world transformation.
Vec translation() const
Returns the Frame translation, defined with respect to the referenceFrame().
void setRotation(const Quaternion &rotation)
Set the current rotation Quaternion.
The Vec class represents 3D positions and 3D vectors.
void setTranslation(const Vec &translation)
Sets the translation() of the frame, locally defined with respect to the referenceFrame().
virtual ~Frame()
Virtual destructor.
The Quaternion class represents 3D rotations and orientations.
const Frame * referenceFrame() const
Returns the reference Frame, in which coordinates system the Frame is defined.
void setConstraint(Constraint *const constraint)
Sets the constraint() attached to the Frame.
The Frame class represents a coordinate system, defined by a position and an orientation.
Quaternion rotation() const
Returns the Frame rotation, defined with respect to the referenceFrame().
An interface class for Frame constraints.
Constraint * constraint() const
Returns the current constraint applied to the Frame.