Home | Download | Screen shots | Discussion | Documentation |
---|
VRML rotations are represented with four single precision floating point components. The first three are an axis of rotation, and the last is rotation in radians.
Public Member Functions | |
rotation () throw () | |
Construct. | |
rotation (const float(&rot)[4]) throw () | |
Construct from an array. | |
rotation (float x, float y, float z, float angle) throw () | |
Construct from x , y , z , and angle components. | |
rotation (const vec3f &axis, float angle) throw () | |
Construct from an axis vector and an angle. | |
rotation (const vec3f &from_vec, const vec3f &to_vec) throw () | |
Construct a rotation between two vectors. | |
rotation (const quatf &quat) throw () | |
Construct from a quaternion. | |
rotation & | operator *= (const rotation &rot) throw () |
Multiply rotations. | |
const float & | operator[] (size_t index) const throw () |
Index-based element access. | |
float | x () const throw () |
Get the x axis component. | |
float | y () const throw () |
Get the y axis component. | |
float | z () const throw () |
Get the z axis component. | |
const vec3f | axis () const throw () |
Get the axis of rotation. | |
float | angle () const throw () |
Get the rotation angle. | |
void | x (float value) throw () |
Set the x axis component. | |
void | y (float value) throw () |
Set the y axis component. | |
void | z (float value) throw () |
Set the z axis component. | |
void | axis (const vec3f &axis) throw () |
Set the axis of rotation. | |
void | angle (float value) throw () |
Set the rotation angle. | |
const rotation | inverse () const throw () |
Inverse rotation. | |
const rotation | slerp (const rotation &dest_rot, float t) const throw () |
Spherical Linear intERPolation. | |
Private Attributes | |
float | rot [4] |
Rotation components. | |
Related Functions | |
(Note that these are not member functions.) | |
const rotation | operator * (const rotation &lhs, const rotation &rhs) throw() |
Multiply rotations. | |
bool | operator== (const rotation &lhs, const rotation &rhs) throw() |
Compare for equality. | |
bool | operator!= (const rotation &lhs, const rotation &rhs) throw() |
Compare for inequality. | |
std::ostream & | operator<< (std::ostream &out, const rotation &r) |
Stream output. |
openvrml::rotation::rotation | ( | ) | throw () |
Construct.
openvrml::rotation::rotation | ( | const float & | rot[4] | ) | throw () [explicit] |
Construct from an array.
rot | an array comprising the rotation components. |
rot
is normalized. openvrml::rotation::rotation | ( | float | x, | |
float | y, | |||
float | z, | |||
float | angle | |||
) | throw () |
Construct from x
, y
, z
, and angle
components.
x | x-component of the rotation axis. | |
y | y-component of the rotation axis. | |
z | z-component of the rotation axis. | |
angle | rotation angle. |
x
, y
, and z
is normalized. openvrml::rotation::rotation | ( | const vec3f & | axis, | |
float | angle | |||
) | throw () |
Construct from an axis vector and an angle.
axis | rotation axis. | |
angle | rotation angle. |
axis
is a normalized vector. Construct a rotation between two vectors.
Construct a rotation equal to the rotation between two different vectors.
from_vec | the starting vector. | |
to_vec | the ending vector. |
openvrml::rotation::rotation | ( | const quatf & | quat | ) | throw () [explicit] |
Construct from a quaternion.
quat | a quaternion. |
Multiply rotations.
rot | the rotation by which to multiply. |
const float & openvrml::rotation::operator[] | ( | size_t | index | ) | const throw () [inline] |
Index-based element access.
index | 0 is the x axis component, 1 is the y axis component, 2 is the z axis component, and 3 is the angle. |
float openvrml::rotation::x | ( | ) | const throw () [inline] |
Get the x axis component.
float openvrml::rotation::y | ( | ) | const throw () [inline] |
Get the y axis component.
float openvrml::rotation::z | ( | ) | const throw () [inline] |
Get the z axis component.
const vec3f openvrml::rotation::axis | ( | ) | const throw () [inline] |
Get the axis of rotation.
float openvrml::rotation::angle | ( | ) | const throw () [inline] |
Get the rotation angle.
void openvrml::rotation::x | ( | float | value | ) | throw () |
Set the x axis component.
value | new x axis component value. |
void openvrml::rotation::y | ( | float | value | ) | throw () |
Set the y axis component.
value | new y axis component value. |
void openvrml::rotation::z | ( | float | value | ) | throw () |
Set the z axis component.
value | new z axis component value. |
void openvrml::rotation::axis | ( | const vec3f & | axis | ) | throw () |
Set the axis of rotation.
axis | new axis of rotation. |
void openvrml::rotation::angle | ( | float | value | ) | throw () [inline] |
Set the rotation angle.
value | new rotation angle value. |
const rotation openvrml::rotation::inverse | ( | ) | const throw () |
Inverse rotation.
Spherical Linear intERPolation.
dest_rot | destination rotation. | |
t | fraction representing the desired position between the rotation and dest_rot . |
t
between the rotation and dest_rot
.
Multiply rotations.
lhs | left-hand operand. | |
rhs | right-hand operand. |
lhs
and rhs
. Compare for equality.
lhs | left-hand operand. | |
rhs | right-hand operand. |
true
if lhs
is equal to rhs
; false
otherwise. Compare for inequality.
lhs | left-hand operand. | |
rhs | right-hand operand. |
true
if lhs
is not equal to rhs
; false
otherwise. std::ostream & operator<< | ( | std::ostream & | out, | |
const rotation & | r | |||
) | [related] |
Stream output.
out | output stream. | |
r | a rotation. |
out
.
float openvrml::rotation::rot[4] [private] |
Rotation components.
For internal use only.
The first three components define an axis through the origin. The fourth component is a rotation around the axis.