Ocean
Ocean::HomogenousMatrixT4< T > Class Template Reference

This class implements a 4x4 homogeneous transformation matrix using floating point values with the precision specified by type T. More...

Inheritance diagram for Ocean::HomogenousMatrixT4< T >:

Public Types

typedef T Type
 Definition of the used data type. More...
 

Public Member Functions

 HomogenousMatrixT4 ()
 Creates a new default HomogenousMatrixT4 object with undefined elements. More...
 
 HomogenousMatrixT4 (const HomogenousMatrixT4< T > &matrix)
 Copy constructor. More...
 
template<typename U >
 HomogenousMatrixT4 (const HomogenousMatrixT4< U > &matrix)
 Copy constructor for a matrix with difference element data type than T. More...
 
 HomogenousMatrixT4 (const bool setToIdentity)
 Creates a new HomogenousMatrixT4. More...
 
template<typename U >
 HomogenousMatrixT4 (const U *arrayValues)
 Creates a new HomogenousMatrixT4 object by 16 given floating point values of type U. More...
 
 HomogenousMatrixT4 (const T *arrayValues)
 Creates a new HomogenousMatrixT4 object by 16 given floating point values. More...
 
template<typename U >
 HomogenousMatrixT4 (const U *arrayValues, const bool valuesRowAligned)
 Creates a new HomogenousMatrixT4 object by an array of at least sixteen elements of float type U. More...
 
 HomogenousMatrixT4 (const T *arrayValues, const bool valuesRowAligned)
 Creates a new HomogenousMatrixT4 object by an array of at least sixteen elements. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation)
 Creates a new HomogenousMatrixT4 object with only a translation. More...
 
 HomogenousMatrixT4 (const RotationT< T > &rotation)
 Creates a new HomogenousMatrixT4 object with only a rotation. More...
 
 HomogenousMatrixT4 (const EulerT< T > &euler)
 Creates a new HomogenousMatrixT4 object with only a rotation given as Euler rotation. More...
 
 HomogenousMatrixT4 (const QuaternionT< T > &rotation)
 Creates a new HomogenousMatrixT4 object with only a rotation given as quaternion. More...
 
 HomogenousMatrixT4 (const SquareMatrixT3< T > &rotation)
 Creates a new HomogenousMatrixT4 object with only a rotation given as 3x3 rotation matrix. More...
 
 HomogenousMatrixT4 (const SquareMatrixT4< T > &matrix)
 Creates a new HomogenousMatrixT4 object from a 4x4 square matrix. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const RotationT< T > &rotation)
 Creates a new HomogenousMatrixT4 object with a translation and rotation. More...
 
 HomogenousMatrixT4 (const std::pair< VectorT3< T >, RotationT< T >> &translationAndRotation)
 Creates a new HomogenousMatrixT4 object with a translation and rotation. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const EulerT< T > &euler)
 Creates a new HomogenousMatrixT4 object with a translation and rotation. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const QuaternionT< T > &rotation)
 Creates a new HomogenousMatrixT4 object with a translation and rotation. More...
 
 HomogenousMatrixT4 (const std::pair< VectorT3< T >, QuaternionT< T >> &translationAndRotation)
 Creates a new HomogenousMatrixT4 object with a translation and rotation. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const SquareMatrixT3< T > &rotation)
 Creates a new HomogenousMatrixT4 object with a translation and rotation matrix. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const VectorT3< T > &scale)
 Creates a new HomogenousMatrixT4 object by a translation and a scale. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const RotationT< T > &rotation, const VectorT3< T > &scale)
 Creates a new HomogenousMatrixT4 object by a translation, rotation and scale. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const QuaternionT< T > &rotation, const VectorT3< T > &scale, const VectorT3< T > &shear)
 Creates a new HomogenousMatrixT4 object by a translation, rotation, scale and shear. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const RotationT< T > &rotation, const VectorT3< T > &scale, const VectorT3< T > &shear)
 Creates a new HomogenousMatrixT4 object by a translation, rotation, scale and shear. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &translation, const QuaternionT< T > &rotation, const VectorT3< T > &scale)
 Creates a new HomogenousMatrixT4 object by a translation, rotation and scale. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &xAxis, const VectorT3< T > &yAxis, const VectorT3< T > &zAxis)
 Creates a new HomogenousMatrixT4 object by three basis vectors. More...
 
 HomogenousMatrixT4 (const VectorT3< T > &xAxis, const VectorT3< T > &yAxis, const VectorT3< T > &zAxis, const VectorT3< T > &translation)
 Creates a new HomogenousMatrixT4 object by three basis vectors and a translation vector. More...
 
VectorT3< T > xAxis () const
 Returns the x-axis of the transformation which is the first vector of the upper left 3x3 rotation matrix of this homogeneous 4x4 transformation. More...
 
VectorT3< T > yAxis () const
 Returns the y-axis of the transformation which is the second vector of the upper left 3x3 rotation matrix of this homogeneous 4x4 transformation. More...
 
VectorT3< T > zAxis () const
 Returns the z-axis of the transformation which is the first vector of the upper left 3x3 rotation matrix of this homogeneous 4x4 transformation. More...
 
VectorT3< T > translation () const
 Returns the translation of the transformation. More...
 
QuaternionT< T > rotation () const
 Returns the rotation of the transformation as quaternion. More...
 
VectorT3< T > scale () const
 Returns the scale of the transformation. More...
 
bool decompose (VectorT3< T > &translation, QuaternionT< T > &rotation, VectorT3< T > &scale, VectorT3< T > &shear) const
 Decomposes the transformation matrix into translation, rotation, scale and shear parameters. More...
 
SquareMatrixT3< T > rotationMatrix () const
 Returns the rotation matrix of the transformation. More...
 
void rotationMatrix (T *data, const bool transposed=false) const
 Copies the 3x3 rotation matrix elements of the 4x4 transformation. More...
 
SquareMatrixT3< T > orthonormalRotationMatrix () const
 Returns the 3x3 orthonormal rotation matrix of the 4x4 transformation (by forcing a orthogonal and normalized rotation matrix). More...
 
SquareMatrixT4< T > transposed () const
 Returns the transposed of this matrix. More...
 
HomogenousMatrixT4< T > inverted () const noexcept
 Returns the inverted of this matrix. More...
 
bool invert ()
 Inverts the matrix. More...
 
bool invert (HomogenousMatrixT4< T > &invertedMatrix) const
 Inverts the matrix and returns the result as parameter. More...
 
determinant () const
 Returns the determinant of the matrix. More...
 
trace () const
 Returns the trace of the matrix which is the sum of the diagonal elements. More...
 
HomogenousMatrixT4< T > & setTranslation (const VectorT3< T > &translation)
 Sets the translation of this transformation. More...
 
HomogenousMatrixT4< T > & setRotation (const RotationT< T > &rotation)
 Sets the rotation of this transformation. More...
 
HomogenousMatrixT4< T > & setRotation (const QuaternionT< T > &quaternion)
 Sets the rotation of this transformation. More...
 
HomogenousMatrixT4< T > & setRotation (const SquareMatrixT3< T > &matrix)
 Sets the rotation of this transformation. More...
 
HomogenousMatrixT4< T > & applyScale (const VectorT3< T > &scale)
 Applies new scale values. More...
 
void toIdentity ()
 Sets the matrix to the identity matrix. More...
 
void toNull ()
 Sets the matrix to a zero matrix (including the lower right element). More...
 
bool isValid () const
 Returns whether this matrix is a valid homogeneous transformation. More...
 
bool isIdentity () const
 Returns whether this matrix is an identity matrix. More...
 
bool isEqual (const HomogenousMatrixT4< T > &matrix, const T epsilon=NumericT< T >::eps()) const
 Returns whether two matrices are almost identical up to a specified epsilon. More...
 
bool isNull () const
 Returns whether this matrix is a zero matrix (with all elements equal to zero). More...
 
const T * data () const
 Returns a pointer to the internal values. More...
 
T * data ()
 Returns a pointer to the internal values. More...
 
void copyElements (T *arrayValues, const bool valuesRowAligned=false) const
 Copies the elements of this matrix to an array with floating point values of the same type T. More...
 
template<typename U >
void copyElements (U *arrayValues, const bool valuesRowAligned=false) const
 Copies the elements of this matrix to an array with floating point values of the type U. More...
 
VectorT3< T > rotationMatrix (const VectorT3< T > &vector) const
 Transforms a 3D vector by application of only the inner rotation matrix (including scale and shearing) of this transformation. More...
 
VectorT3< T > transposedRotationMatrix (const VectorT3< T > &vector) const
 Transforms a 3D vector by application of only the inner transposed rotation matrix (including scale and shearing) of this transformation. More...
 
HomogenousMatrixT4< T > & operator= (const HomogenousMatrixT4< T > &)=default
 Default copy assignment operator. More...
 
bool operator== (const HomogenousMatrixT4< T > &matrix) const
 Returns whether two transformations are identical up to a small epsilon. More...
 
bool operator!= (const HomogenousMatrixT4< T > &matrix) const
 Returns whether two transformations are not identical up to a small epsilon. More...
 
HomogenousMatrixT4< T > operator* (const HomogenousMatrixT4< T > &matrix) const
 Combines two transformation matrices. More...
 
HomogenousMatrixT4< T > & operator*= (const HomogenousMatrixT4< T > &matrix)
 Combines and assigns two transformation matrices. More...
 
HomogenousMatrixT4< T > operator* (const RotationT< T > &rotation) const
 Combines a transformation with a rotation. More...
 
HomogenousMatrixT4< T > & operator*= (const RotationT< T > &rotation)
 Combines and assigns a transformation with a rotation. More...
 
HomogenousMatrixT4< T > operator* (const QuaternionT< T > &rotation) const
 Combines a transformation with a quaternion rotation. More...
 
HomogenousMatrixT4< T > & operator*= (const QuaternionT< T > &rotation)
 Combines and assigns a transformation with a quaternion rotation. More...
 
VectorT3< T > operator* (const VectorT3< T > &vector) const
 Transforms a 3D vector. More...
 
VectorT4< T > operator* (const VectorT4< T > &vector) const
 Transforms a 4D vector. More...
 
operator[] (const unsigned int index) const
 Element operator. More...
 
T & operator[] (const unsigned int index)
 Element operator. More...
 
operator() (const unsigned int row, const unsigned int column) const
 Element operator. More...
 
T & operator() (const unsigned int row, const unsigned int column)
 Element operator. More...
 
operator() (const unsigned int index) const
 Element operator. More...
 
T & operator() (const unsigned int index)
 Element operator. More...
 
const T * operator() () const
 Access operator. More...
 
T * operator() ()
 Access operator. More...
 
size_t operator() (const HomogenousMatrixT4< T > &matrix) const
 Hash function. More...
 
template<typename T >
 HomogenousMatrixT4 (const std::pair< VectorT3< T >, RotationT< T > > &translationAndRotation)
 
template<typename T >
 HomogenousMatrixT4 (const std::pair< VectorT3< T >, QuaternionT< T > > &translationAndRotation)
 
std::vector< HomogenousMatrixT4< float > > matrices2matrices (const std::vector< HomogenousMatrixT4< float > > &matrices)
 
std::vector< HomogenousMatrixT4< double > > matrices2matrices (const std::vector< HomogenousMatrixT4< double > > &matrices)
 

Static Public Member Functions

template<typename U >
static std::vector< HomogenousMatrixT4< T > > matrices2matrices (const std::vector< HomogenousMatrixT4< U > > &matrices)
 Converts matrices with specific data type to matrices with different data type. More...
 
template<typename U >
static std::vector< HomogenousMatrixT4< T > > matrices2matrices (const HomogenousMatrixT4< U > *matrices, const size_t size)
 Converts matrices with specific data type to matrices with different data type. More...
 

Protected Attributes

values_ [16]
 The sixteen values of the transformation matrix. More...
 

Friends

template<typename U >
class HomogenousMatrixT4
 

Detailed Description

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

This class implements a 4x4 homogeneous transformation matrix using floating point values with the precision specified by type T.

The values are stored in a column major/aligned order with indices:
| 0  4  8  12 |
| 1  5  9  13 |
| 2  6  10 14 |
| 3  7  11 15 |

This matrix allows homogeneous transformations only.
With basis vectors (rx1, ry1, rz1), (rx2, ry2, rz2), (rx3, ry3, rz3), and translation vector (tx, ty, tz):
| rx1 rx2 rx3 tx |
| ry1 ry2 ry3 ty |
| rz1 rz2 rz3 tz |
|  0   0   0   1 |
Template Parameters
TData type of matrix elements
See also
HomogenousMatrix4, HomogenousMatrixF4, HomogenousMatrixD4.

Member Typedef Documentation

◆ Type

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

Definition of the used data type.

Constructor & Destructor Documentation

◆ HomogenousMatrixT4() [1/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4
inline

Creates a new default HomogenousMatrixT4 object with undefined elements.

Beware: This matrix is neither a zero nor an entity matrix!

◆ HomogenousMatrixT4() [2/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const HomogenousMatrixT4< T > &  matrix)
inline

Copy constructor.

Parameters
matrixThe matrix to copy

◆ HomogenousMatrixT4() [3/29]

template<typename T >
template<typename U >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const HomogenousMatrixT4< U > &  matrix)
inlineexplicit

Copy constructor for a matrix with difference element data type than T.

Parameters
matrixThe matrix to copy
Template Parameters
UThe element data type of the second matrix

◆ HomogenousMatrixT4() [4/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const bool  setToIdentity)
inlineexplicit

Creates a new HomogenousMatrixT4.

Beware: The zero matrix will hold a zero in the lower right corner which must be set explicitly later to create a valid matrix.
Only constructors explicitly set the lower right value to 1 like e.g., the constructor building a matrix from a rotation or translation and so on.

Parameters
setToIdentityTrue, to create a identity matrix; False, to set a zero matrix

◆ HomogenousMatrixT4() [5/29]

template<typename T >
template<typename U >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const U *  arrayValues)
explicit

Creates a new HomogenousMatrixT4 object by 16 given floating point values of type U.

Parameters
arrayValuesThe array with 16 matrix elements of type U

◆ HomogenousMatrixT4() [6/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const T *  arrayValues)
explicit

Creates a new HomogenousMatrixT4 object by 16 given floating point values.

Parameters
arrayValuesThe array with 16 matrix elements

◆ HomogenousMatrixT4() [7/29]

template<typename T >
template<typename U >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const U *  arrayValues,
const bool  valuesRowAligned 
)

Creates a new HomogenousMatrixT4 object by an array of at least sixteen elements of float type U.

Parameters
arrayValuesThe sixteen matrix elements defining the new matrix, must be valid
valuesRowAlignedTrue, if the given values are stored in a row aligned order; False, if the values are stored in a column aligned order (which is the default case for this matrix)
Template Parameters
UThe floating point type of the given elements

◆ HomogenousMatrixT4() [8/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const T *  arrayValues,
const bool  valuesRowAligned 
)

Creates a new HomogenousMatrixT4 object by an array of at least sixteen elements.

Parameters
valuesRowAlignedTrue, if the given values are stored in a row aligned order; False, if the values are stored in a column aligned order (which is the default case for this matrix)
arrayValuesThe sixteen matrix elements defining the new matrix, must be valid

◆ HomogenousMatrixT4() [9/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation)
explicit

Creates a new HomogenousMatrixT4 object with only a translation.

Parameters
translationThe translation of the resulting transformation

◆ HomogenousMatrixT4() [10/29]

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

Creates a new HomogenousMatrixT4 object with only a rotation.

Parameters
rotationThe angle-axis rotation of the resulting transformation

◆ HomogenousMatrixT4() [11/29]

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

Creates a new HomogenousMatrixT4 object with only a rotation given as Euler rotation.

Parameters
eulerThe euler rotation of the resulting transformation

◆ HomogenousMatrixT4() [12/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const QuaternionT< T > &  rotation)
explicit

Creates a new HomogenousMatrixT4 object with only a rotation given as quaternion.

Parameters
rotationThe rotation of the resulting transformation

◆ HomogenousMatrixT4() [13/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const SquareMatrixT3< T > &  rotation)
explicit

Creates a new HomogenousMatrixT4 object with only a rotation given as 3x3 rotation matrix.

Parameters
rotation3x3 rotation matrix

◆ HomogenousMatrixT4() [14/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const SquareMatrixT4< T > &  matrix)
explicit

Creates a new HomogenousMatrixT4 object from a 4x4 square matrix.

Parameters
matrixThe 4x4 square matrix

◆ HomogenousMatrixT4() [15/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const RotationT< T > &  rotation 
)

Creates a new HomogenousMatrixT4 object with a translation and rotation.

The resulting transformation can be written as the following matrix multiplication:

HomogenousMatrix4(translation, rotation) == HomogenousMatrix4(translation) * HomogenousMatrix4(rotation)
Parameters
translationThe translation of the resulting transformation
rotationThe rotation of the resulting transformation, must be valid

◆ HomogenousMatrixT4() [16/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const std::pair< VectorT3< T >, RotationT< T >> &  translationAndRotation)
explicit

Creates a new HomogenousMatrixT4 object with a translation and rotation.

Parameters
translationAndRotationThe pair of translation and rotation of the resulting transformation

◆ HomogenousMatrixT4() [17/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const EulerT< T > &  euler 
)

Creates a new HomogenousMatrixT4 object with a translation and rotation.

The resulting transformation can be written as the following matrix multiplication:

HomogenousMatrix4(translation, euler) == HomogenousMatrix4(translation) * HomogenousMatrix4(euler)
Parameters
translationThe translation of the resulting transformation
eulerThe euler rotation of the resulting transformation, must be valid

◆ HomogenousMatrixT4() [18/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const QuaternionT< T > &  rotation 
)

Creates a new HomogenousMatrixT4 object with a translation and rotation.

The resulting transformation can be written as the following matrix multiplication:

HomogenousMatrix4(translation, rotation) == HomogenousMatrix4(translation) * HomogenousMatrix4(rotation)
Parameters
translationThe translation of the resulting transformation
rotationThe quaternion rotation of the resulting transformation, must be valid

◆ HomogenousMatrixT4() [19/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const std::pair< VectorT3< T >, QuaternionT< T >> &  translationAndRotation)
explicit

Creates a new HomogenousMatrixT4 object with a translation and rotation.

Parameters
translationAndRotationThe pair of translation and rotation of the resulting transformation

◆ HomogenousMatrixT4() [20/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const SquareMatrixT3< T > &  rotation 
)

Creates a new HomogenousMatrixT4 object with a translation and rotation matrix.

The resulting transformation can be written as the following matrix multiplication:

HomogenousMatrix4(translation, rotation) == HomogenousMatrix4(translation) * HomogenousMatrix4(rotation)
Parameters
translationThe translation of the resulting transformation
rotationThe rotation matrix of the resulting transformation, must be valid

◆ HomogenousMatrixT4() [21/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const VectorT3< T > &  scale 
)

Creates a new HomogenousMatrixT4 object by a translation and a scale.

Parameters
translationThe translation of the resulting transformation
scaleThe scale of the resulting transformation

◆ HomogenousMatrixT4() [22/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const RotationT< T > &  rotation,
const VectorT3< T > &  scale 
)

Creates a new HomogenousMatrixT4 object by a translation, rotation and scale.

Parameters
translationThe translation of the resulting transformation
rotationThe rotation of the resulting transformation, must be valid
scaleThe scale of the resulting transformation

◆ HomogenousMatrixT4() [23/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const QuaternionT< T > &  rotation,
const VectorT3< T > &  scale,
const VectorT3< T > &  shear 
)

Creates a new HomogenousMatrixT4 object by a translation, rotation, scale and shear.

Parameters
translationThe translation of the resulting transformation
rotationThe rotation of the resulting transformation as unit quaternion, must be valid
scaleThe scale of the resulting transformation
shearThe shear of the resulting transformation with order (xy, xz, yz)

◆ HomogenousMatrixT4() [24/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const RotationT< T > &  rotation,
const VectorT3< T > &  scale,
const VectorT3< T > &  shear 
)

Creates a new HomogenousMatrixT4 object by a translation, rotation, scale and shear.

Parameters
translationThe translation of the resulting transformation
rotationThe rotation of the resulting transformation, must be valid
scaleThe scale of the resulting transformation
shearThe shear of the resulting transformation with order (xy, xz, yz)

◆ HomogenousMatrixT4() [25/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  translation,
const QuaternionT< T > &  rotation,
const VectorT3< T > &  scale 
)

Creates a new HomogenousMatrixT4 object by a translation, rotation and scale.

Parameters
translationThe translation of the resulting transformation
rotationThe quaternion rotation of the resulting transformation, must be valid
scaleThe scale of the resulting transformation

◆ HomogenousMatrixT4() [26/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  xAxis,
const VectorT3< T > &  yAxis,
const VectorT3< T > &  zAxis 
)

Creates a new HomogenousMatrixT4 object by three basis vectors.

Parameters
xAxisFirst basis vector
yAxisSecond basis vector
zAxisThird basis vector

◆ HomogenousMatrixT4() [27/29]

template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const VectorT3< T > &  xAxis,
const VectorT3< T > &  yAxis,
const VectorT3< T > &  zAxis,
const VectorT3< T > &  translation 
)

Creates a new HomogenousMatrixT4 object by three basis vectors and a translation vector.

Parameters
xAxisFirst basis vector
yAxisSecond basis vector
zAxisThird basis vector
translationThe translation vector

◆ HomogenousMatrixT4() [28/29]

template<typename T >
template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const std::pair< VectorT3< T >, RotationT< T > > &  translationAndRotation)

◆ HomogenousMatrixT4() [29/29]

template<typename T >
template<typename T >
Ocean::HomogenousMatrixT4< T >::HomogenousMatrixT4 ( const std::pair< VectorT3< T >, QuaternionT< T > > &  translationAndRotation)

Member Function Documentation

◆ applyScale()

template<typename T >
HomogenousMatrixT4< T > & Ocean::HomogenousMatrixT4< T >::applyScale ( const VectorT3< T > &  scale)

Applies new scale values.

Parameters
scaleThe new scale values which are applied to the inner 3x3 rotation matrix
Returns
Reference to this transformation matrix

◆ copyElements() [1/2]

template<typename T >
void Ocean::HomogenousMatrixT4< T >::copyElements ( T *  arrayValues,
const bool  valuesRowAligned = false 
) const
inline

Copies the elements of this matrix to an array with floating point values of the same type T.

Parameters
arrayValuesArray with 16 floating point values of type T receiving the elements of this matrix, must be valid
valuesRowAlignedTrue, if the target values are stored in a row aligned order; False, if the values are stored in a column aligned order (which is the default case for this matrix)

◆ copyElements() [2/2]

template<typename T >
template<typename U >
void Ocean::HomogenousMatrixT4< T >::copyElements ( U *  arrayValues,
const bool  valuesRowAligned = false 
) const
inline

Copies the elements of this matrix to an array with floating point values of the type U.

Parameters
arrayValuesArray with 16 floating point values of type U receiving the elements of this matrix, must be valid
valuesRowAlignedTrue, if the target values are stored in a row aligned order; False, if the values are stored in a column aligned order (which is the default case for this matrix)

◆ data() [1/2]

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

Returns a pointer to the internal values.

Returns
The pointer to the internal values, always valid

◆ data() [2/2]

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

Returns a pointer to the internal values.

Returns
The pointer to the internal values, always valid

◆ decompose()

template<typename T >
bool Ocean::HomogenousMatrixT4< T >::decompose ( VectorT3< T > &  translation,
QuaternionT< T > &  rotation,
VectorT3< T > &  scale,
VectorT3< T > &  shear 
) const

Decomposes the transformation matrix into translation, rotation, scale and shear parameters.

Parameters
translationThe returning translation parameter
rotationThe returning rotation parameter as quaternion
scaleThe returning scale parameter
shearThe returning shear parameter with order (xy, xz, yz)
Returns
True, if succeeded (otherwise the transformation matrix has a zero-scaling axis and the translation is decomposed only)

◆ determinant()

template<typename T >
T Ocean::HomogenousMatrixT4< T >::determinant

Returns the determinant of the matrix.

Returns
Matrix determinant

◆ invert() [1/2]

template<typename T >
bool Ocean::HomogenousMatrixT4< T >::invert

Inverts the matrix.

Returns
True, if the matrix could be inverted (because the matrix was not singular)

◆ invert() [2/2]

template<typename T >
bool Ocean::HomogenousMatrixT4< T >::invert ( HomogenousMatrixT4< T > &  invertedMatrix) const

Inverts the matrix and returns the result as parameter.

Parameters
invertedMatrixThe resulting inverted matrix
Returns
True, if the matrix could be inverted because the matrix is not singular
See also
inverted(), solve().

◆ inverted()

template<typename T >
HomogenousMatrixT4< T > Ocean::HomogenousMatrixT4< T >::inverted
noexcept

Returns the inverted of this matrix.

This matrix must not be singular, ensure that the matrix is invertible before calling this function.
Even better: avoid the usage of this function and call invert() instead.
In case, this matrix is not invertible, this matrix will be returned instead.

Returns
The inverted matrix see invert().

◆ isEqual()

template<typename T >
bool Ocean::HomogenousMatrixT4< T >::isEqual ( const HomogenousMatrixT4< T > &  matrix,
const T  epsilon = NumericT<T>::eps() 
) const
inline

Returns whether two matrices are almost identical up to a specified epsilon.

Parameters
matrixSecond matrix that will be checked
epsilonThe epsilon threshold to be used, with range [0, infinity)
Returns
True, if so

◆ isIdentity()

template<typename T >
bool Ocean::HomogenousMatrixT4< T >::isIdentity

Returns whether this matrix is an identity matrix.

Returns
True, if so
See also
toIdentity().

◆ isNull()

template<typename T >
bool Ocean::HomogenousMatrixT4< T >::isNull

Returns whether this matrix is a zero matrix (with all elements equal to zero).

Returns
True, if so
See also
toNull().

◆ isValid()

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

Returns whether this matrix is a valid homogeneous transformation.

Returns
True, if so

◆ matrices2matrices() [1/4]

template<typename T >
template<typename U >
std::vector< HomogenousMatrixT4< T > > Ocean::HomogenousMatrixT4< T >::matrices2matrices ( const HomogenousMatrixT4< U > *  matrices,
const size_t  size 
)
inlinestatic

Converts matrices with specific data type to matrices with different data type.

Parameters
matricesThe matrices to convert
sizeThe number of matrices to convert
Returns
The converted matrices
Template Parameters
UThe element data type of the matrices to convert

◆ matrices2matrices() [2/4]

std::vector< HomogenousMatrixT4< double > > Ocean::HomogenousMatrixT4< double >::matrices2matrices ( const std::vector< HomogenousMatrixT4< double > > &  matrices)
inline

◆ matrices2matrices() [3/4]

std::vector< HomogenousMatrixT4< float > > Ocean::HomogenousMatrixT4< float >::matrices2matrices ( const std::vector< HomogenousMatrixT4< float > > &  matrices)
inline

◆ matrices2matrices() [4/4]

template<typename T >
template<typename U >
std::vector< HomogenousMatrixT4< T > > Ocean::HomogenousMatrixT4< T >::matrices2matrices ( const std::vector< HomogenousMatrixT4< U > > &  matrices)
inlinestatic

Converts matrices with specific data type to matrices with different data type.

Parameters
matricesThe matrices to convert
Returns
The converted matrices
Template Parameters
UThe element data type of the matrices to convert

◆ operator!=()

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

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

Parameters
matrixRight operand
Returns
True, if so

◆ operator()() [1/7]

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

Access operator.

Returns
Pointer to the internal values

◆ operator()() [2/7]

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

Access operator.

Returns
Pointer to the internal values

◆ operator()() [3/7]

template<typename T >
size_t Ocean::HomogenousMatrixT4< T >::operator() ( const HomogenousMatrixT4< T > &  matrix) const
inline

Hash function.

Parameters
matrixThe matrix for which the hash value will be determined
Returns
The resulting hash value

◆ operator()() [4/7]

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

Element operator.

Parameters
indexThe index of the element to return [0, 15]
Returns
Specified element

◆ operator()() [5/7]

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

Element operator.

Parameters
indexThe index of the element to return [0, 15]
Returns
Specified element

◆ operator()() [6/7]

template<typename T >
T & Ocean::HomogenousMatrixT4< T >::operator() ( const unsigned int  row,
const unsigned int  column 
)
inline

Element operator.

Parameters
rowThe row of the element to return [0, 3]
columnThe column of the element to return [0, 3]
Returns
Specified element

◆ operator()() [7/7]

template<typename T >
T Ocean::HomogenousMatrixT4< T >::operator() ( const unsigned int  row,
const unsigned int  column 
) const
inline

Element operator.

Parameters
rowThe row of the element to return [0, 3]
columnThe column of the element to return [0, 3]
Returns
Specified element

◆ operator*() [1/5]

template<typename T >
HomogenousMatrixT4< T > Ocean::HomogenousMatrixT4< T >::operator* ( const HomogenousMatrixT4< T > &  matrix) const

Combines two transformation matrices.

Parameters
matrixRight transformation matrix
Returns
Combined transformation matrix

◆ operator*() [2/5]

template<typename T >
HomogenousMatrixT4< T > Ocean::HomogenousMatrixT4< T >::operator* ( const QuaternionT< T > &  rotation) const

Combines a transformation with a quaternion rotation.

Parameters
rotationThe quaternion rotation to combine, must be valid
Returns
Combined transformation matrix

◆ operator*() [3/5]

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

Combines a transformation with a rotation.

Parameters
rotationThe rotation to combine, must be valid
Returns
Combined transformation matrix

◆ operator*() [4/5]

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

Transforms a 3D vector.

The vector will be extended with a 1.0 as fourth element and de-homogenized afterwards.

Parameters
vectorThe vector to transform
Returns
Resulting transformed and homogenized 3D vector

◆ operator*() [5/5]

template<typename T >
VectorT4< T > Ocean::HomogenousMatrixT4< T >::operator* ( const VectorT4< T > &  vector) const
inline

Transforms a 4D vector.

Parameters
vectorThe vector to transform
Returns
The resulting transformed 4D vector

◆ operator*=() [1/3]

template<typename T >
HomogenousMatrixT4< T > & Ocean::HomogenousMatrixT4< T >::operator*= ( const HomogenousMatrixT4< T > &  matrix)
inline

Combines and assigns two transformation matrices.

Parameters
matrixRight transformation matrix
Returns
Reference to this transformation matrix

◆ operator*=() [2/3]

template<typename T >
HomogenousMatrixT4< T > & Ocean::HomogenousMatrixT4< T >::operator*= ( const QuaternionT< T > &  rotation)
inline

Combines and assigns a transformation with a quaternion rotation.

Parameters
rotationThe quaternion rotation to combine, must be valid
Returns
Reference to this transformation matrix

◆ operator*=() [3/3]

template<typename T >
HomogenousMatrixT4< T > & Ocean::HomogenousMatrixT4< T >::operator*= ( const RotationT< T > &  rotation)
inline

Combines and assigns a transformation with a rotation.

Parameters
rotationThe rotation to combine, must be valid
Returns
Reference to this transformation matrix

◆ operator=()

template<typename T >
HomogenousMatrixT4<T>& Ocean::HomogenousMatrixT4< T >::operator= ( const HomogenousMatrixT4< T > &  )
default

Default copy assignment operator.

Returns
Reference to this object

◆ operator==()

template<typename T >
bool Ocean::HomogenousMatrixT4< T >::operator== ( const HomogenousMatrixT4< T > &  matrix) const

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

Parameters
matrixRight operand
Returns
True, if so

◆ operator[]() [1/2]

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

Element operator.

Parameters
indexThe index of the element to return [0, 15]
Returns
Specified element

◆ operator[]() [2/2]

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

Element operator.

Parameters
indexThe index of the element to return [0, 15]
Returns
Specified element

◆ orthonormalRotationMatrix()

template<typename T >
SquareMatrixT3< T > Ocean::HomogenousMatrixT4< T >::orthonormalRotationMatrix

Returns the 3x3 orthonormal rotation matrix of the 4x4 transformation (by forcing a orthogonal and normalized rotation matrix).

All vectors of the resulting rotation matrix have unit length.

Returns
The normalized rotation matrix

◆ rotation()

template<typename T >
QuaternionT< T > Ocean::HomogenousMatrixT4< T >::rotation

Returns the rotation of the transformation as quaternion.

Returns
Rotation

◆ rotationMatrix() [1/3]

template<typename T >
SquareMatrixT3< T > Ocean::HomogenousMatrixT4< T >::rotationMatrix
inline

Returns the rotation matrix of the transformation.

Returns
Rotation matrix containing scale

◆ rotationMatrix() [2/3]

template<typename T >
VectorT3< T > Ocean::HomogenousMatrixT4< T >::rotationMatrix ( const VectorT3< T > &  vector) const
inline

Transforms a 3D vector by application of only the inner rotation matrix (including scale and shearing) of this transformation.

Parameters
vectorThe vector to be transformed
Returns
Transformed 3D vector

◆ rotationMatrix() [3/3]

template<typename T >
void Ocean::HomogenousMatrixT4< T >::rotationMatrix ( T *  data,
const bool  transposed = false 
) const
inline

Copies the 3x3 rotation matrix elements of the 4x4 transformation.

Parameters
dataThe buffer receiving the nine rotation matrix elements, must be valid
transposedTrue, to copy the transposed rotation matrix (to copy the array into a row major buffer); False, to copy the matrix into a column major buffer

◆ scale()

template<typename T >
VectorT3< T > Ocean::HomogenousMatrixT4< T >::scale

Returns the scale of the transformation.

Returns
Transformation scale

◆ setRotation() [1/3]

template<typename T >
HomogenousMatrixT4< T > & Ocean::HomogenousMatrixT4< T >::setRotation ( const QuaternionT< T > &  quaternion)

Sets the rotation of this transformation.

Parameters
quaternionThe quaternion rotation to set, must be valid
Returns
Reference to this transformation matrix

◆ setRotation() [2/3]

template<typename T >
HomogenousMatrixT4< T > & Ocean::HomogenousMatrixT4< T >::setRotation ( const RotationT< T > &  rotation)

Sets the rotation of this transformation.

Parameters
rotationThe rotation to set, must be valid
Returns
Reference to this transformation matrix

◆ setRotation() [3/3]

template<typename T >
HomogenousMatrixT4< T > & Ocean::HomogenousMatrixT4< T >::setRotation ( const SquareMatrixT3< T > &  matrix)

Sets the rotation of this transformation.

Parameters
matrixThe 3x3 rotation matrix to set
Returns
Reference to this transformation matrix

◆ setTranslation()

template<typename T >
HomogenousMatrixT4< T > & Ocean::HomogenousMatrixT4< T >::setTranslation ( const VectorT3< T > &  translation)
inline

Sets the translation of this transformation.

Parameters
translationThe translation to set
Returns
Reference to this transformation matrix

◆ toIdentity()

template<typename T >
void Ocean::HomogenousMatrixT4< T >::toIdentity
inline

Sets the matrix to the identity matrix.

See also
isIdentity().

◆ toNull()

template<typename T >
void Ocean::HomogenousMatrixT4< T >::toNull
inline

Sets the matrix to a zero matrix (including the lower right element).

See also
isNull();

◆ trace()

template<typename T >
T Ocean::HomogenousMatrixT4< T >::trace
inline

Returns the trace of the matrix which is the sum of the diagonal elements.

Returns
Trace of the matrix

◆ translation()

template<typename T >
VectorT3< T > Ocean::HomogenousMatrixT4< T >::translation
inline

Returns the translation of the transformation.

Returns
Translation

◆ transposed()

template<typename T >
SquareMatrixT4< T > Ocean::HomogenousMatrixT4< T >::transposed

Returns the transposed of this matrix.

Returns
Transposed matrix as square 4x4 matrix

◆ transposedRotationMatrix()

template<typename T >
VectorT3< T > Ocean::HomogenousMatrixT4< T >::transposedRotationMatrix ( const VectorT3< T > &  vector) const
inline

Transforms a 3D vector by application of only the inner transposed rotation matrix (including scale and shearing) of this transformation.

Parameters
vectorThe vector to be transformed
Returns
Transformed 3D vector

◆ xAxis()

template<typename T >
VectorT3< T > Ocean::HomogenousMatrixT4< T >::xAxis
inline

Returns the x-axis of the transformation which is the first vector of the upper left 3x3 rotation matrix of this homogeneous 4x4 transformation.

Returns
The x-axis of this transformation

◆ yAxis()

template<typename T >
VectorT3< T > Ocean::HomogenousMatrixT4< T >::yAxis
inline

Returns the y-axis of the transformation which is the second vector of the upper left 3x3 rotation matrix of this homogeneous 4x4 transformation.

Returns
The y-axis of this transformation

◆ zAxis()

template<typename T >
VectorT3< T > Ocean::HomogenousMatrixT4< T >::zAxis
inline

Returns the z-axis of the transformation which is the first vector of the upper left 3x3 rotation matrix of this homogeneous 4x4 transformation.

Returns
The z-axis of this transformation

Friends And Related Function Documentation

◆ HomogenousMatrixT4

template<typename T >
template<typename U >
friend class HomogenousMatrixT4
friend

Field Documentation

◆ values_

template<typename T >
T Ocean::HomogenousMatrixT4< T >::values_[16]
protected

The sixteen values of the transformation matrix.


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