Ocean
|
This class implements a axis-angle rotation using floating point values. More...
Public Types | |
typedef T | Type |
Definition of the used data type. More... | |
Public Member Functions | |
RotationT ()=default | |
Creates a rotation object with default values so that the rotation represents the identity rotation. More... | |
RotationT (const T x, const T y, const T z, const T angle) | |
Creates a rotation object by four given values. More... | |
RotationT (const VectorT3< T > &axis, const T angle) | |
Creates a rotation object by an axis and the angle. More... | |
RotationT (const VectorT3< T > &reference, const VectorT3< T > &offset) | |
Creates a rotation object based on two given unit vectors. More... | |
RotationT (const QuaternionT< T > &quaternion) | |
Creates a rotation object by a given quaternion rotation. More... | |
RotationT (const EulerT< T > &euler) | |
Creates an angle-axis rotation by a given euler rotation. More... | |
RotationT (const SquareMatrixT3< T > &matrix) | |
Creates a rotation object by a given 3x3 rotation matrix. More... | |
RotationT (const HomogenousMatrixT4< T > &transformation) | |
Creates a rotation object by a given 4x4 transformation matrix. More... | |
RotationT (const T *valueArray) | |
Creates a rotation object by an array with four elements. More... | |
void | setAxis (const VectorT3< T > &axis) |
Sets the axis of the rotation. More... | |
void | setAngle (const T angle) |
Sets the angle of the rotation. More... | |
const T * | data () const |
Returns a pointer to the internal values. More... | |
T * | data () |
Returns a pointer to the internal values. More... | |
VectorT3< T > | axis () const |
Returns the axis of the rotation. More... | |
T | angle () const |
Returns the angle of the rotation. More... | |
RotationT | inverted () const |
Returns the inverted rotation, this rotation must be valid. More... | |
void | invert () |
Inverts this rotation, this rotation must be valid. More... | |
bool | isValid () const |
Returns whether this rotation has valid parameters. More... | |
bool | operator== (const RotationT< T > &right) const |
Returns whether two rotations are identical up to a small epsilon. More... | |
bool | operator!= (const RotationT< T > &right) const |
Returns whether two rotations are not identical up to a small epsilon. More... | |
RotationT | operator- () const |
Returns the inverse rotation, this rotation must be valid. More... | |
RotationT | operator* (const QuaternionT< T > &quaternion) const |
Multiplies two rotations, this rotation must be valid. More... | |
RotationT & | operator*= (const QuaternionT< T > &quaternion) |
Multiplies and assign two rotations, this rotation must be valid. More... | |
RotationT | operator* (const RotationT< T > &right) const |
Multiplies two rotations, this rotation must be valid. More... | |
RotationT & | operator*= (const RotationT< T > &right) |
Multiplies and assign two rotations, this rotation must be valid. More... | |
VectorT3< T > | operator* (const VectorT3< T > &vector) const |
Rotates a 3D vector with this rotation, this rotation must be valid. More... | |
T | operator() (unsigned int index) const |
Element access operator. More... | |
T & | operator() (unsigned int index) |
Element access operator. More... | |
T | operator[] (unsigned int index) const |
Element access operator. More... | |
T & | operator[] (unsigned int index) |
Element access operator. More... | |
const T * | operator() () const |
Access operator. More... | |
T * | operator() () |
Access operator. More... | |
Protected Attributes | |
T | values_ [4] = {T(0), T(1), T(0), T(0)} |
The four values of the angle-axis rotation. More... | |
This class implements a axis-angle rotation using floating point values.
The angle is defined in radian [0, 2*PI).
The four elements are stored with order: (x, y, z, angle).
T | Data type used to represent axis and angle |
typedef T Ocean::RotationT< T >::Type |
Definition of the used data type.
|
default |
Creates a rotation object with default values so that the rotation represents the identity rotation.
The axis will be set to (0, 1, 0) and the angle to 0.
Ocean::RotationT< T >::RotationT | ( | const T | x, |
const T | y, | ||
const T | z, | ||
const T | angle | ||
) |
Creates a rotation object by four given values.
The axis must have length 1.
x | X value of the rotation axis |
y | Y value of the rotation axis |
z | Z value of the rotation axis |
angle | The angle of the rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI) |
Ocean::RotationT< T >::RotationT | ( | const VectorT3< T > & | axis, |
const T | angle | ||
) |
Creates a rotation object by an axis and the angle.
axis | The axis of the rotation with length 1 |
angle | The angle of the rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI) |
Ocean::RotationT< T >::RotationT | ( | const VectorT3< T > & | reference, |
const VectorT3< T > & | offset | ||
) |
Creates a rotation object based on two given unit vectors.
The resulting rotation defines a transformation that rotates that reference vector into the offset vector: Rotation(reference, offset) = offset_R_reference.
The following equation holds:
offset = Rotation(reference, offset) * reference.
reference | The reference vector, with length 1 |
offset | The offset vector, with length 1 |
|
explicit |
Creates a rotation object by a given quaternion rotation.
quaternion | the quaternion rotation to create an axis-angle rotation from, must be valid |
|
explicit |
Creates an angle-axis rotation by a given euler rotation.
euler | Euler rotation to create a angle-axis rotation from, must be valid |
|
explicit |
Creates a rotation object by a given 3x3 rotation matrix.
Beware: Ensure that the provided matrix does not contain any scale.
matrix | Rotation matrix to create a axis-angle rotation from, with determinant 1 |
|
explicit |
Creates a rotation object by a given 4x4 transformation matrix.
transformation | The transformation matrix to create a axis-angle rotation from, must be valid |
|
explicit |
Creates a rotation object by an array with four elements.
The element order in the array has to be: (x, y, z, angle).
The axis must have length 1, the angle is provided as radian with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI)
valueArray | Array with four elements |
|
inline |
Returns the angle of the rotation.
|
inline |
Returns the axis of the rotation.
|
inline |
Returns a pointer to the internal values.
|
inline |
Returns a pointer to the internal values.
void Ocean::RotationT< T >::invert |
Inverts this rotation, this rotation must be valid.
RotationT< T > Ocean::RotationT< T >::inverted |
bool Ocean::RotationT< T >::isValid |
Returns whether this rotation has valid parameters.
|
inline |
Returns whether two rotations are not identical up to a small epsilon.
right | The right operand |
|
inline |
Access operator.
|
inline |
Access operator.
|
inline |
Element access operator.
index | The index of the element to return, with range [0, 3] |
|
inline |
Element access operator.
index | The index of the element to return, with range [0, 3] |
RotationT< T > Ocean::RotationT< T >::operator* | ( | const QuaternionT< T > & | quaternion | ) | const |
Multiplies two rotations, this rotation must be valid.
quaternion | The right rotation as unit quaternion, must be valid |
RotationT< T > Ocean::RotationT< T >::operator* | ( | const RotationT< T > & | right | ) | const |
Multiplies two rotations, this rotation must be valid.
right | The right rotation to multiply, must be valid |
VectorT3< T > Ocean::RotationT< T >::operator* | ( | const VectorT3< T > & | vector | ) | const |
Rotates a 3D vector with this rotation, this rotation must be valid.
vector | The vector to rotate |
RotationT< T > & Ocean::RotationT< T >::operator*= | ( | const QuaternionT< T > & | quaternion | ) |
Multiplies and assign two rotations, this rotation must be valid.
quaternion | The right rotation as unit quaternion, must be valid |
RotationT< T > & Ocean::RotationT< T >::operator*= | ( | const RotationT< T > & | right | ) |
Multiplies and assign two rotations, this rotation must be valid.
right | The right rotation to multiply, must be valid |
RotationT< T > Ocean::RotationT< T >::operator- |
Returns the inverse rotation, this rotation must be valid.
bool Ocean::RotationT< T >::operator== | ( | const RotationT< T > & | right | ) | const |
Returns whether two rotations are identical up to a small epsilon.
right | The right operand |
|
inline |
Element access operator.
index | The index of the element to return, with range [0, 3] |
|
inline |
Element access operator.
index | The index of the element to return, with range [0, 3] |
void Ocean::RotationT< T >::setAngle | ( | const T | angle | ) |
Sets the angle of the rotation.
angle | The angle of rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI) |
void Ocean::RotationT< T >::setAxis | ( | const VectorT3< T > & | axis | ) |
Sets the axis of the rotation.
axis | The axis with length 1 |
|
protected |
The four values of the angle-axis rotation.