Home | Download | Screen shots | Discussion | Documentation |
---|
#include <openvrml/basetypes.h>
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 & | operator*= (const rotation &rot) throw () |
Multiply rotations. | |
const float & | operator[] (std::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. | |
Public Attributes | |
float | rot [4] |
Rotation components. | |
Related Functions | |
(Note that these are not member functions.) | |
const openvrml::rotation | make_rotation () throw() |
Create a default rotation . | |
const openvrml::rotation | make_rotation (const float(&rot)[4]) throw() |
Create a rotation from an array. | |
const openvrml::rotation | make_rotation (const float x, const float y, const float z, const float angle) throw() |
Create a rotation from x , y , z , and angle components. | |
const openvrml::rotation | make_rotation (const vec3f &axis, const float angle) throw() |
Create a rotation from an axis vector and an angle. | |
const openvrml::rotation | make_rotation (const vec3f &from_vec, const vec3f &to_vec) throw() |
Create a rotation equal to the rotation between two different vectors. | |
const openvrml::rotation | make_rotation (const quatf &quat) throw() |
Create a rotation from a quaternion. | |
const openvrml::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::istream & | operator>> (std::istream &in, rotation &rot) |
Stream input. | |
std::ostream & | operator<< (std::ostream &out, const rotation &r) |
Stream output. |
openvrml::rotation & openvrml::rotation::operator*= | ( | const rotation & | rot | ) | throw () |
Multiply rotations.
[in] | rot | the rotation by which to multiply. |
const float & openvrml::rotation::operator[] | ( | std::size_t | index | ) | const throw () [inline] |
Index-based element access.
[in] | 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] |
float openvrml::rotation::angle | ( | ) | const throw () [inline] |
void openvrml::rotation::x | ( | float | value | ) | throw () |
Set the x axis component.
[in] | value | new x axis component value. |
void openvrml::rotation::y | ( | float | value | ) | throw () |
Set the y axis component.
[in] | value | new y axis component value. |
void openvrml::rotation::z | ( | float | value | ) | throw () |
Set the z axis component.
[in] | value | new z axis component value. |
void openvrml::rotation::axis | ( | const vec3f & | axis | ) | throw () |
void openvrml::rotation::angle | ( | float | value | ) | throw () [inline] |
const openvrml::rotation openvrml::rotation::inverse | ( | ) | const throw () |
const openvrml::rotation openvrml::rotation::slerp | ( | const rotation & | dest_rot, | |
float | t | |||
) | const throw () |
const openvrml::rotation make_rotation | ( | ) | throw() [related] |
const openvrml::rotation make_rotation | ( | const float(&) | rot[4] | ) | throw() [related] |
Create a rotation
from an array.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | rot | an array comprising the rotation components. |
rot
is normalized.rotation
initialized to the values in rot
. const openvrml::rotation make_rotation | ( | const float | x, | |
const float | y, | |||
const float | z, | |||
const float | angle | |||
) | throw() [related] |
Create a rotation
from x
, y
, z
, and angle
components.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | x | x-component of the rotation axis. |
[in] | y | y-component of the rotation axis. |
[in] | z | z-component of the rotation axis. |
[in] | angle | rotation angle. |
x
, y
, and z
is normalized.rotation
initialized to [ x
, y
, z
, angle
]. const openvrml::rotation make_rotation | ( | const vec3f & | axis, | |
const float | angle | |||
) | throw() [related] |
const openvrml::rotation make_rotation | ( | const vec3f & | from_vec, | |
const vec3f & | to_vec | |||
) | throw() [related] |
const openvrml::rotation make_rotation | ( | const quatf & | quat | ) | throw() [related] |
const openvrml::rotation operator* | ( | const rotation & | lhs, | |
const rotation & | rhs | |||
) | throw() [related] |
Multiply rotations.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
lhs
and rhs
. Compare for equality.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
true
if lhs
is equal to rhs
; false
otherwise. Compare for inequality.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
true
if lhs
is not equal to rhs
; false
otherwise. std::istream & operator>> | ( | std::istream & | in, | |
rotation & | rot | |||
) | [related] |
Stream input.
Consistent with the VRML97 convention, commas (“,”) in the input are treated as whitespace.
If the axis components of the rotation do not represent a normalized vector, the failbit
will be set on in
and rot
will not be modified.
[in,out] | in | input stream. |
[out] | rot | a rotation . |
in
. std::ostream & operator<< | ( | std::ostream & | out, | |
const rotation & | r | |||
) | [related] |
float openvrml::rotation::rot[4] |
Rotation components.
The first three components define an axis through the origin. The fourth component is a rotation around the axis.