Public Types | Public Member Functions | Public Attributes | Private Member Functions | List of all members
lvr2::Matrix4< BaseVecT > Class Template Reference

A 4x4 matrix class implementation for use with the provided vertex types. More...

#include <Matrix4.hpp>

Public Types

using ValueType = typename BaseVecT::CoordType
 

Public Member Functions

ValueType at (const int i) const
 Returns the element at the given index. More...
 
ValueType det ()
 Returns the matrix's determinant. More...
 
ValueTypegetData ()
 Returns the internal data array. Unsafe. Will probably removed in one of the next versions. More...
 
std::vector< ValueTypegetVector ()
 
Matrix4< BaseVecT > inv (bool &success)
 
void loadFromFile (string filename)
 Loads matrix values from a given file. More...
 
 Matrix4 ()
 Default constructor. Initializes a identity matrix. More...
 
template<typename T >
 Matrix4 (const Matrix4< T > &other)
 Copy constructor. More...
 
template<typename T >
 Matrix4 (const T &position, const T &angles)
 
 Matrix4 (string filename)
 
template<typename T >
 Matrix4 (T *matrix)
 Initializes a matrix wit the given data array. Ensure that the array has exactly 16 fields. More...
 
template<typename T >
 Matrix4 (T axis, ValueType angle)
 Constructs a matrix from given axis and angle. Trys to avoid a gimbal lock. More...
 
template<typename T >
Matrix4< BaseVecT > operator* (const Matrix4< T > &other) const
 Matrix-Matrix multiplication. Returns the new matrix. More...
 
template<typename T >
Normal< T > operator* (const Normal< T > &v) const
 Multiplication of Matrix and Vertex types. More...
 
template<typename T >
operator* (const T &v) const
 Multiplication of Matrix and Vertex types. More...
 
template<typename T >
Matrix4< BaseVecT > operator* (const T *&other) const
 Matrix-Matrix multiplication (array based). Mainly implemented for compatibility with other math libs. ensure that the used array has at least 16 elements to avoid memory access violations. More...
 
Matrix4< BaseVecT > operator* (const ValueType &scale) const
 Scales the matrix elemnts by the given factor. More...
 
template<typename T >
void operator*= (const Matrix4< T > &other)
 Matrix-Matrix multiplication with self assigment. More...
 
template<typename T >
void operator*= (const T *other)
 Matrix-Matrix multiplication (array based). See operator*}. More...
 
template<typename T >
void operator*= (const T scale)
 Matrix scaling with self assignment. More...
 
template<typename T >
Matrix4< BaseVecT > operator+ (const Matrix4< T > &other) const
 Matrix addition operator. Returns a new matrix. More...
 
template<typename T >
Matrix4< BaseVecT > operator+= (const Matrix4< T > &other)
 Matrix addition operator. More...
 
Matrix4operator= (const Eigen::Matrix4d &mat)
 
ValueTypeoperator[] (const int index)
 Writeable index access. More...
 
ValueType operator[] (const int index) const
 Indexed element (reading) access. More...
 
void set (int i, ValueType value)
 Sets the given index of the Matrix's data field to the provided value. More...
 
Eigen::Matrix4d toEigenMatrix ()
 
floatArr toFloatArray ()
 
void toPostionAngle (ValueType pose[6])
 Computes an Euler representation (x, y, z) plus three rotation values in rad. Rotations are with respect to the x, y, z axes. More...
 
void transpose ()
 Transposes the current matrix. More...
 
 ~Matrix4 ()
 

Public Attributes

ValueType m [16]
 

Private Member Functions

ValueType det3 (const ValueType *M)
 Calculates the determinant of a 3x3 matrix. More...
 
void submat (ValueType *submat, int i, int j)
 Returns a sub matrix without row i and column j. More...
 

Detailed Description

template<typename BaseVecT>
class lvr2::Matrix4< BaseVecT >

A 4x4 matrix class implementation for use with the provided vertex types.

Definition at line 64 of file Matrix4.hpp.

Member Typedef Documentation

◆ ValueType

template<typename BaseVecT >
using lvr2::Matrix4< BaseVecT >::ValueType = typename BaseVecT::CoordType

Definition at line 67 of file Matrix4.hpp.

Constructor & Destructor Documentation

◆ Matrix4() [1/6]

template<typename BaseVecT >
lvr2::Matrix4< BaseVecT >::Matrix4 ( )
inline

Default constructor. Initializes a identity matrix.

Definition at line 72 of file Matrix4.hpp.

◆ Matrix4() [2/6]

template<typename BaseVecT >
template<typename T >
lvr2::Matrix4< BaseVecT >::Matrix4 ( T *  matrix)
inline

Initializes a matrix wit the given data array. Ensure that the array has exactly 16 fields.

Definition at line 83 of file Matrix4.hpp.

◆ Matrix4() [3/6]

template<typename BaseVecT >
template<typename T >
lvr2::Matrix4< BaseVecT >::Matrix4 ( const Matrix4< T > &  other)
inline

Copy constructor.

Definition at line 92 of file Matrix4.hpp.

◆ Matrix4() [4/6]

template<typename BaseVecT >
template<typename T >
lvr2::Matrix4< BaseVecT >::Matrix4 ( axis,
ValueType  angle 
)
inline

Constructs a matrix from given axis and angle. Trys to avoid a gimbal lock.

Definition at line 102 of file Matrix4.hpp.

◆ Matrix4() [5/6]

template<typename BaseVecT >
template<typename T >
lvr2::Matrix4< BaseVecT >::Matrix4 ( const T &  position,
const T &  angles 
)
inline

Definition at line 176 of file Matrix4.hpp.

◆ Matrix4() [6/6]

template<typename BaseVecT >
lvr2::Matrix4< BaseVecT >::Matrix4 ( string  filename)

◆ ~Matrix4()

template<typename BaseVecT >
lvr2::Matrix4< BaseVecT >::~Matrix4 ( )
inline

Definition at line 207 of file Matrix4.hpp.

Member Function Documentation

◆ at()

template<typename BaseVecT >
ValueType lvr2::Matrix4< BaseVecT >::at ( const int  i) const

Returns the element at the given index.

◆ det()

template<typename BaseVecT >
ValueType lvr2::Matrix4< BaseVecT >::det ( )
inline

Returns the matrix's determinant.

Definition at line 561 of file Matrix4.hpp.

◆ det3()

template<typename BaseVecT >
ValueType lvr2::Matrix4< BaseVecT >::det3 ( const ValueType M)
inlineprivate

Calculates the determinant of a 3x3 matrix.

Parameters
Minput 3x3 matrix
Returns
determinant of input matrix

Definition at line 622 of file Matrix4.hpp.

◆ getData()

template<typename BaseVecT >
ValueType* lvr2::Matrix4< BaseVecT >::getData ( )
inline

Returns the internal data array. Unsafe. Will probably removed in one of the next versions.

Definition at line 513 of file Matrix4.hpp.

◆ getVector()

template<typename BaseVecT >
std::vector<ValueType> lvr2::Matrix4< BaseVecT >::getVector ( )
inline

Definition at line 525 of file Matrix4.hpp.

◆ inv()

template<typename BaseVecT >
Matrix4<BaseVecT> lvr2::Matrix4< BaseVecT >::inv ( bool &  success)
inline

Definition at line 574 of file Matrix4.hpp.

◆ loadFromFile()

template<typename BaseVecT >
void lvr2::Matrix4< BaseVecT >::loadFromFile ( string  filename)
inline

Loads matrix values from a given file.

Definition at line 470 of file Matrix4.hpp.

◆ operator*() [1/5]

template<typename BaseVecT >
template<typename T >
Matrix4<BaseVecT> lvr2::Matrix4< BaseVecT >::operator* ( const Matrix4< T > &  other) const
inline

Matrix-Matrix multiplication. Returns the new matrix.

Definition at line 281 of file Matrix4.hpp.

◆ operator*() [2/5]

template<typename BaseVecT >
template<typename T >
Normal<T> lvr2::Matrix4< BaseVecT >::operator* ( const Normal< T > &  v) const
inline

Multiplication of Matrix and Vertex types.

Definition at line 385 of file Matrix4.hpp.

◆ operator*() [3/5]

template<typename BaseVecT >
template<typename T >
T lvr2::Matrix4< BaseVecT >::operator* ( const T &  v) const
inline

Multiplication of Matrix and Vertex types.

Definition at line 367 of file Matrix4.hpp.

◆ operator*() [4/5]

template<typename BaseVecT >
template<typename T >
Matrix4<BaseVecT> lvr2::Matrix4< BaseVecT >::operator* ( const T *&  other) const
inline

Matrix-Matrix multiplication (array based). Mainly implemented for compatibility with other math libs. ensure that the used array has at least 16 elements to avoid memory access violations.

Definition at line 341 of file Matrix4.hpp.

◆ operator*() [5/5]

template<typename BaseVecT >
Matrix4<BaseVecT> lvr2::Matrix4< BaseVecT >::operator* ( const ValueType scale) const
inline

Scales the matrix elemnts by the given factor.

Definition at line 267 of file Matrix4.hpp.

◆ operator*=() [1/3]

template<typename BaseVecT >
template<typename T >
void lvr2::Matrix4< BaseVecT >::operator*= ( const Matrix4< T > &  other)
inline

Matrix-Matrix multiplication with self assigment.

Definition at line 495 of file Matrix4.hpp.

◆ operator*=() [2/3]

template<typename BaseVecT >
template<typename T >
void lvr2::Matrix4< BaseVecT >::operator*= ( const T *  other)
inline

Matrix-Matrix multiplication (array based). See operator*}.

Definition at line 504 of file Matrix4.hpp.

◆ operator*=() [3/3]

template<typename BaseVecT >
template<typename T >
void lvr2::Matrix4< BaseVecT >::operator*= ( const T  scale)
inline

Matrix scaling with self assignment.

Definition at line 486 of file Matrix4.hpp.

◆ operator+()

template<typename BaseVecT >
template<typename T >
Matrix4<BaseVecT> lvr2::Matrix4< BaseVecT >::operator+ ( const Matrix4< T > &  other) const
inline

Matrix addition operator. Returns a new matrix.

Definition at line 308 of file Matrix4.hpp.

◆ operator+=()

template<typename BaseVecT >
template<typename T >
Matrix4<BaseVecT> lvr2::Matrix4< BaseVecT >::operator+= ( const Matrix4< T > &  other)
inline

Matrix addition operator.

Definition at line 322 of file Matrix4.hpp.

◆ operator=()

template<typename BaseVecT >
Matrix4& lvr2::Matrix4< BaseVecT >::operator= ( const Eigen::Matrix4d &  mat)
inline

Definition at line 212 of file Matrix4.hpp.

◆ operator[]() [1/2]

template<typename BaseVecT >
ValueType& lvr2::Matrix4< BaseVecT >::operator[] ( const int  index)
inline

Writeable index access.

Definition at line 553 of file Matrix4.hpp.

◆ operator[]() [2/2]

template<typename BaseVecT >
ValueType lvr2::Matrix4< BaseVecT >::operator[] ( const int  index) const
inline

Indexed element (reading) access.

TODO: Boundary check

Definition at line 543 of file Matrix4.hpp.

◆ set()

template<typename BaseVecT >
void lvr2::Matrix4< BaseVecT >::set ( int  i,
ValueType  value 
)
inline

Sets the given index of the Matrix's data field to the provided value.

Parameters
iField index of the matrix
valuenew value

Definition at line 401 of file Matrix4.hpp.

◆ submat()

template<typename BaseVecT >
void lvr2::Matrix4< BaseVecT >::submat ( ValueType submat,
int  i,
int  j 
)
inlineprivate

Returns a sub matrix without row i and column j.

Definition at line 601 of file Matrix4.hpp.

◆ toEigenMatrix()

template<typename BaseVecT >
Eigen::Matrix4d lvr2::Matrix4< BaseVecT >::toEigenMatrix ( )
inline

Definition at line 237 of file Matrix4.hpp.

◆ toFloatArray()

template<typename BaseVecT >
floatArr lvr2::Matrix4< BaseVecT >::toFloatArray ( )
inline

Definition at line 515 of file Matrix4.hpp.

◆ toPostionAngle()

template<typename BaseVecT >
void lvr2::Matrix4< BaseVecT >::toPostionAngle ( ValueType  pose[6])
inline

Computes an Euler representation (x, y, z) plus three rotation values in rad. Rotations are with respect to the x, y, z axes.

Definition at line 433 of file Matrix4.hpp.

◆ transpose()

template<typename BaseVecT >
void lvr2::Matrix4< BaseVecT >::transpose ( )
inline

Transposes the current matrix.

Definition at line 406 of file Matrix4.hpp.

Member Data Documentation

◆ m

template<typename BaseVecT >
ValueType lvr2::Matrix4< BaseVecT >::m[16]

Definition at line 594 of file Matrix4.hpp.


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


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:27