Ocean
Ocean::RotationT< T > Class Template Reference

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...
 
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...
 
RotationToperator*= (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...
 
RotationToperator*= (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...
 
operator() (unsigned int index) const
 Element access operator. More...
 
T & operator() (unsigned int index)
 Element access operator. More...
 
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

values_ [4] = {T(0), T(1), T(0), T(0)}
 The four values of the angle-axis rotation. More...
 

Detailed Description

template<typename T>
class Ocean::RotationT< T >

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).

Template Parameters
TData type used to represent axis and angle
See also
Rotation, RotationF, RotationD, Quaternion, Euler, SquareMatrix3, ExponentialMap.

Member Typedef Documentation

◆ Type

template<typename T >
typedef T Ocean::RotationT< T >::Type

Definition of the used data type.

Constructor & Destructor Documentation

◆ RotationT() [1/9]

template<typename T >
Ocean::RotationT< T >::RotationT ( )
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.

◆ RotationT() [2/9]

template<typename T >
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.

Parameters
xX value of the rotation axis
yY value of the rotation axis
zZ value of the rotation axis
angleThe angle of the rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI)

◆ RotationT() [3/9]

template<typename T >
Ocean::RotationT< T >::RotationT ( const VectorT3< T > &  axis,
const T  angle 
)

Creates a rotation object by an axis and the angle.

Parameters
axisThe axis of the rotation with length 1
angleThe angle of the rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI)

◆ RotationT() [4/9]

template<typename T >
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.
Parameters
referenceThe reference vector, with length 1
offsetThe offset vector, with length 1

◆ RotationT() [5/9]

template<typename T >
Ocean::RotationT< T >::RotationT ( const QuaternionT< T > &  quaternion)
explicit

Creates a rotation object by a given quaternion rotation.

Parameters
quaternionthe quaternion rotation to create an axis-angle rotation from, must be valid

◆ RotationT() [6/9]

template<typename T >
Ocean::RotationT< T >::RotationT ( const EulerT< T > &  euler)
explicit

Creates an angle-axis rotation by a given euler rotation.

Parameters
eulerEuler rotation to create a angle-axis rotation from, must be valid

◆ RotationT() [7/9]

template<typename T >
Ocean::RotationT< T >::RotationT ( const SquareMatrixT3< T > &  matrix)
explicit

Creates a rotation object by a given 3x3 rotation matrix.

Beware: Ensure that the provided matrix does not contain any scale.

Parameters
matrixRotation matrix to create a axis-angle rotation from, with determinant 1

◆ RotationT() [8/9]

template<typename T >
Ocean::RotationT< T >::RotationT ( const HomogenousMatrixT4< T > &  transformation)
explicit

Creates a rotation object by a given 4x4 transformation matrix.

Parameters
transformationThe transformation matrix to create a axis-angle rotation from, must be valid

◆ RotationT() [9/9]

template<typename T >
Ocean::RotationT< T >::RotationT ( const T *  valueArray)
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)

Parameters
valueArrayArray with four elements

Member Function Documentation

◆ angle()

template<typename T >
T Ocean::RotationT< T >::angle
inline

Returns the angle of the rotation.

Returns
Rotation angle in radian, with range [0.0, 2 * PI)

◆ axis()

template<typename T >
VectorT3< T > Ocean::RotationT< T >::axis
inline

Returns the axis of the rotation.

Returns
Rotation axis with unit length if the rotation is valid

◆ data() [1/2]

template<typename T >
T * Ocean::RotationT< T >::data
inline

Returns a pointer to the internal values.

Returns
Pointer to the internal values

◆ data() [2/2]

template<typename T >
const T * Ocean::RotationT< T >::data
inline

Returns a pointer to the internal values.

Returns
Pointer to the internal values

◆ invert()

template<typename T >
void Ocean::RotationT< T >::invert

Inverts this rotation, this rotation must be valid.

See also
isValid(), inverted().

◆ inverted()

template<typename T >
RotationT< T > Ocean::RotationT< T >::inverted

Returns the inverted rotation, this rotation must be valid.

Returns
Inverted rotation
See also
isValid(), invert().

◆ isValid()

template<typename T >
bool Ocean::RotationT< T >::isValid

Returns whether this rotation has valid parameters.

Returns
True, if so

◆ operator!=()

template<typename T >
bool Ocean::RotationT< T >::operator!= ( const RotationT< T > &  right) const
inline

Returns whether two rotations are not identical up to a small epsilon.

Parameters
rightThe right operand
Returns
True, if so

◆ operator()() [1/4]

template<typename T >
T * Ocean::RotationT< T >::operator()
inline

Access operator.

Returns
Pointer to the internal elements.

◆ operator()() [2/4]

template<typename T >
const T * Ocean::RotationT< T >::operator()
inline

Access operator.

Returns
Pointer to the internal elements.

◆ operator()() [3/4]

template<typename T >
T & Ocean::RotationT< T >::operator() ( unsigned int  index)
inline

Element access operator.

Parameters
indexThe index of the element to return, with range [0, 3]
Returns
Internal element

◆ operator()() [4/4]

template<typename T >
T Ocean::RotationT< T >::operator() ( unsigned int  index) const
inline

Element access operator.

Parameters
indexThe index of the element to return, with range [0, 3]
Returns
Internal element

◆ operator*() [1/3]

template<typename T >
RotationT< T > Ocean::RotationT< T >::operator* ( const QuaternionT< T > &  quaternion) const

Multiplies two rotations, this rotation must be valid.

Parameters
quaternionThe right rotation as unit quaternion, must be valid
Returns
Resulting rotation

◆ operator*() [2/3]

template<typename T >
RotationT< T > Ocean::RotationT< T >::operator* ( const RotationT< T > &  right) const

Multiplies two rotations, this rotation must be valid.

Parameters
rightThe right rotation to multiply, must be valid
Returns
Resulting rotation

◆ operator*() [3/3]

template<typename T >
VectorT3< T > Ocean::RotationT< T >::operator* ( const VectorT3< T > &  vector) const

Rotates a 3D vector with this rotation, this rotation must be valid.

Parameters
vectorThe vector to rotate
Returns
Rotated vector

◆ operator*=() [1/2]

template<typename T >
RotationT< T > & Ocean::RotationT< T >::operator*= ( const QuaternionT< T > &  quaternion)

Multiplies and assign two rotations, this rotation must be valid.

Parameters
quaternionThe right rotation as unit quaternion, must be valid
Returns
Reference to this rotation

◆ operator*=() [2/2]

template<typename T >
RotationT< T > & Ocean::RotationT< T >::operator*= ( const RotationT< T > &  right)

Multiplies and assign two rotations, this rotation must be valid.

Parameters
rightThe right rotation to multiply, must be valid
Returns
Reference to this rotation

◆ operator-()

template<typename T >
RotationT< T > Ocean::RotationT< T >::operator-

Returns the inverse rotation, this rotation must be valid.

Returns
Inverse rotation

◆ operator==()

template<typename T >
bool Ocean::RotationT< T >::operator== ( const RotationT< T > &  right) const

Returns whether two rotations are identical up to a small epsilon.

Parameters
rightThe right operand
Returns
True, if so

◆ operator[]() [1/2]

template<typename T >
T & Ocean::RotationT< T >::operator[] ( unsigned int  index)
inline

Element access operator.

Parameters
indexThe index of the element to return, with range [0, 3]
Returns
Internal element

◆ operator[]() [2/2]

template<typename T >
T Ocean::RotationT< T >::operator[] ( unsigned int  index) const
inline

Element access operator.

Parameters
indexThe index of the element to return, with range [0, 3]
Returns
Internal element

◆ setAngle()

template<typename T >
void Ocean::RotationT< T >::setAngle ( const T  angle)

Sets the angle of the rotation.

Parameters
angleThe angle of rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI)

◆ setAxis()

template<typename T >
void Ocean::RotationT< T >::setAxis ( const VectorT3< T > &  axis)

Sets the axis of the rotation.

Parameters
axisThe axis with length 1

Field Documentation

◆ values_

template<typename T >
T Ocean::RotationT< T >::values_[4] = {T(0), T(1), T(0), T(0)}
protected

The four values of the angle-axis rotation.


The documentation for this class was generated from the following files: