#include <dms/SimpleTransform.h> SimpleTransform(void); virtual void apply(void); void setTranslation(const Vector3& trans); void setTranslation(GLfloat x,GLfloat y,GLfloat z); void setRotation(GLfloat angle,const Vector3& axis); void setRotation(GLfloat angle,GLfloat x,GLfloat y,GLfloat z); void setScaling(GLfloat s); void setScaling(const Vector3& s); void setScaling(GLfloat x,GLfloat y,GLfloat z); Vector3 translation(void); GLfloat rotationAngle(void); Vector3 rotationAxis(void); Vector3 scaling(void);
SimpleTransform(void)
The constructor initializes the SimpleTransform's translation and rotation to 0, and the scale to 1.
void apply(void)
Applies the SimpleTransform to the OpenGL transformation matrix. The transformation is applied as a translation, followed by a rotation, followed by a scale.
void setTranslation(const Vector3& trans) void setTranslation(GLfloat x,GLfloat y,GLfloat z) Vector3 translation(void)
Sets / returns the SimpleTransform's translation value.
Multiple calls to setTranslation() do not accumulate - each
call replaces the previous value.
Example:
xform.setTranslation(10.0, 0.0, 5.0); xform.apply();
void setRotation(GLfloat angle,const Vector3& axis) void setRotation(GLfloat angle,GLfloat x,GLfloat y,GLfloat z) GLfloat rotationAngle(void) Vector3 rotationAxis(void)
Sets / returns the SimpleTransform's rotation - an angle
(in degrees) and an axis.
Multiple calls to setRotation() do not accumulate - each
call replaces the previous value.
Example:
xform.setRotation(30.0, Vector3::X_Axis); xform2.setRotation(17.5, 1.0, 1.0, 2.0);
void setScaling(GLfloat s) void setScaling(const Vector3& s) void setScaling(GLfloat x,GLfloat y,GLfloat z) Vector3 scaling(void);
Sets / returns the SimpleTransform's scaling factors.
Calling setScaling() with a single argument will perform a
uniform scale - the same scale factor will be used for X, Y, and Z.
Example:
xform.setScaling(3); xform2.setScaling(0.707, 2.0, 0.707);