Storage class for matrix templates with support for xx
, xy
, xz
, etc., members for appropriate dimensions.
More...
Classes | |
struct | mi::math::Matrix_struct<T, ROW, COL> |
Storage class for a NxM-dimensional matrix class template of fixed dimensions. More... | |
struct | mi::math::Matrix_struct<T, 1, 1> |
Specialization for 1x1-matrix. More... | |
struct | mi::math::Matrix_struct<T, 2, 1> |
Specialization for 2x1-matrix. More... | |
struct | mi::math::Matrix_struct<T, 3, 1> |
Specialization for 3x1-matrix. More... | |
struct | mi::math::Matrix_struct<T, 4, 1> |
Specialization for 4x1-matrix. More... | |
struct | mi::math::Matrix_struct<T, 1, 2> |
Specialization for 1x2-matrix. More... | |
struct | mi::math::Matrix_struct<T, 2, 2> |
Specialization for 2x2-matrix. More... | |
struct | mi::math::Matrix_struct<T, 3, 2> |
Specialization for 3x2-matrix. More... | |
struct | mi::math::Matrix_struct<T, 4, 2> |
Specialization for 4x2-matrix. More... | |
struct | mi::math::Matrix_struct<T, 1, 3> |
Specialization for 1x3-matrix. More... | |
struct | mi::math::Matrix_struct<T, 2, 3> |
Specialization for 2x3-matrix. More... | |
struct | mi::math::Matrix_struct<T, 3, 3> |
Specialization for 3x3-matrix. More... | |
struct | mi::math::Matrix_struct<T, 4, 3> |
Specialization for 4x3-matrix. More... | |
struct | mi::math::Matrix_struct<T, 1, 4> |
Specialization for 1x4-matrix. More... | |
struct | mi::math::Matrix_struct<T, 2, 4> |
Specialization for 2x4-matrix. More... | |
struct | mi::math::Matrix_struct<T, 3, 4> |
Specialization for 3x4-matrix. More... | |
struct | mi::math::Matrix_struct<T, 4, 4> |
Specialization for 4x4-matrix. More... | |
class | mi::math::Matrix<T, ROW, COL> |
NxM-dimensional matrix class template of fixed dimensions. More... | |
Enumerations | |
enum | mi::math::Matrix<T, ROW, COL>::Transposed_copy_tag { mi::math::Matrix<T, ROW, COL>::TRANSPOSED_COPY_TAG } |
Enum type used to tag a special copy constructor that transposes the matrix while copying. More... | |
Functions | |
template<typename T , Size ROW, Size COL> | |
T * | mi::math::matrix_base_ptr (Matrix_struct<T, ROW, COL> &mat) |
Returns the base pointer to the matrix data. More... | |
template<typename T , Size ROW, Size COL> | |
const T * | mi::math::matrix_base_ptr (const Matrix_struct<T, ROW, COL> &mat) |
Returns the base pointer to the matrix data. More... | |
static Size | mi::math::Matrix<T, ROW, COL>::size () |
Constant size of the vector. More... | |
static Size | mi::math::Matrix<T, ROW, COL>::max_size () |
Constant maximum size of the vector. More... | |
T * | mi::math::Matrix<T, ROW, COL>::begin () |
Returns the pointer to the first matrix element. More... | |
T const * | mi::math::Matrix<T, ROW, COL>::begin () const |
Returns the pointer to the first matrix element. More... | |
T * | mi::math::Matrix<T, ROW, COL>::end () |
Returns the past-the-end pointer. More... | |
T const * | mi::math::Matrix<T, ROW, COL>::end () const |
Returns the past-the-end pointer. More... | |
Row_vector & | mi::math::Matrix<T, ROW, COL>::operator[] (Size row) |
Accesses the row-th row vector, 0 <= row < ROW . More... | |
const Row_vector & | mi::math::Matrix<T, ROW, COL>::operator[] (Size row) const |
Accesses the row-th row vector, 0 <= row < ROW . More... | |
mi::math::Matrix<T, ROW, COL>::Matrix () | |
The default constructor leaves the vector elements uninitialized. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (const Matrix<T, ROW, COL> &other)=default | |
Default copy constructor. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (const Matrix_struct<T, ROW, COL> &other) | |
Constructor from underlying storage type. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T diag) | |
Constructor initializes all matrix elements to zero and the diagonal elements to diag . More... | |
template<typename Iterator> | |
mi::math::Matrix<T, ROW, COL>::Matrix (From_iterator_tag, Iterator p) | |
Constructor requires the mi::math::FROM_ITERATOR tag as first argument and initializes the matrix elements with the first ROW times COL elements from the sequence starting at the iterator p . More... | |
template<typename T2> | |
mi::math::Matrix<T, ROW, COL>::Matrix (T2 const (&array)[SIZE]) | |
Constructor initializes the matrix elements from an array of dimension ROW times COL . More... | |
template<typename T2> | |
mi::math::Matrix<T, ROW, COL>::Matrix (const Matrix<T2, ROW, COL> &other) | |
Template constructor that allows explicit conversions from other matrices with assignment compatible element value type. More... | |
template<typename T2> | |
mi::math::Matrix<T, ROW, COL>::Matrix (const Matrix_struct<T2, ROW, COL> &other) | |
Template constructor that allows explicit conversions from underlying storage type with assignment compatible element value type. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (Transposed_copy_tag, const Matrix<T, COL, ROW> &other) | |
Constructor that initializes the matrix with the transpose matrix of other . More... | |
template<typename T2> | |
mi::math::Matrix<T, ROW, COL>::Matrix (Transposed_copy_tag, const Matrix<T2, COL, ROW> &other) | |
Template constructor that initializes the matrix with the transpose matrix of other that allows the explicit conversions from other matrices with assignment compatible element value type. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (const Row_vector &v0) | |
Dedicated constructor, for ROW==1 only, that initializes matrix from one row vector v0 . More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (const Row_vector &v0, const Row_vector &v1) | |
Dedicated constructor, for ROW==2 only, that initializes matrix from two row vectors (v0,v1). More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (const Row_vector &v0, const Row_vector &v1, const Row_vector &v2) | |
Dedicated constructor, for ROW==3 only, that initializes matrix from three row vectors (v0,v1,v2). More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (const Row_vector &v0, const Row_vector &v1, const Row_vector &v2, const Row_vector &v3) | |
Dedicated constructor, for ROW==4 only, that initializes matrix from four row vectors (v0,v1,v2,v3). More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T m0, T m1) | |
2-element constructor, must be a 1x2 or 2x1 matrix. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T m0, T m1, T m2) | |
3-element constructor, must be a 1x3 or 3x1 matrix. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T m0, T m1, T m2, T m3) | |
4-element constructor, must be a 1x4, 2x2, or 4x1 matrix. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T m0, T m1, T m2, T m3, T m4, T m5) | |
6-element constructor, must be a 2x3 or 3x2 matrix. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T m0, T m1, T m2, T m3, T m4, T m5, T m6, T m7) | |
8-element constructor, must be a 2x4 or 4x2 matrix. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T m0, T m1, T m2, T m3, T m4, T m5, T m6, T m7, T m8) | |
9-element constructor, must be a 3x3 matrix. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T m0, T m1, T m2, T m3, T m4, T m5, T m6, T m7, T m8, T m9, T m10, T m11) | |
12-element constructor, must be a 3x4 or 4x3 matrix. More... | |
mi::math::Matrix<T, ROW, COL>::Matrix (T m0, T m1, T m2, T m3, T m4, T m5, T m6, T m7, T m8, T m9, T m10, T m11, T m12, T m13, T m14, T m15) | |
16-element constructor, must be a 4x4 matrix. More... | |
Matrix & | mi::math::Matrix<T, ROW, COL>::operator= (const Matrix &other) |
Assignment. More... | |
T & | mi::math::Matrix<T, ROW, COL>::operator() (Size row, Size col) |
Accesses the (row ,col )-th matrix element. More... | |
const T & | mi::math::Matrix<T, ROW, COL>::operator() (Size row, Size col) const |
Accesses the (row , col )-th matrix element. More... | |
T | mi::math::Matrix<T, ROW, COL>::get (Size i) const |
Accesses the i-th matrix element, indexed in the order of the row-major memory layout. More... | |
T | mi::math::Matrix<T, ROW, COL>::get (Size row, Size col) const |
Accesses the (row , col )-th matrix element. More... | |
void | mi::math::Matrix<T, ROW, COL>::set (Size i, T value) |
Sets the i-th matrix element to value , indexed in the order of the row-major memory layout. More... | |
void | mi::math::Matrix<T, ROW, COL>::set (Size row, Size col, T value) |
Sets the i-th matrix element to value , indexed in the order of the row-major memory layout. More... | |
T | mi::math::Matrix<T, ROW, COL>::det33 () const |
Returns the determinant of the upper-left 3x3 sub-matrix. More... | |
bool | mi::math::Matrix<T, ROW, COL>::invert () |
Inverts this matrix and returns success or failure. More... | |
void | mi::math::Matrix<T, ROW, COL>::transpose () |
Transposes this matrix by exchanging rows and columns. More... | |
void | mi::math::Matrix<T, ROW, COL>::translate (T x, T y, T z) |
Adds a relative translation to the matrix (by components). More... | |
void | mi::math::Matrix<T, ROW, COL>::translate (const Vector< Float32, 3 > &vector) |
Adds a relative translation to the matrix (by vector). More... | |
void | mi::math::Matrix<T, ROW, COL>::translate (const Vector< Float64, 3 > &vector) |
Adds a relative translation to the matrix (by vector). More... | |
void | mi::math::Matrix<T, ROW, COL>::set_translation (T dx, T dy, T dz) |
Stores an absolute translation in the matrix (by component). More... | |
void | mi::math::Matrix<T, ROW, COL>::set_translation (const Vector< Float32, 3 > &vector) |
Stores an absolute translation in the matrix (by vector). More... | |
void | mi::math::Matrix<T, ROW, COL>::set_translation (const Vector< Float64, 3 > &vector) |
Stores an absolute translation in the matrix (by vector). More... | |
void | mi::math::Matrix<T, ROW, COL>::rotate (T xangle, T yangle, T zangle) |
Adds a relative rotation to the matrix (Euler angles, by component). More... | |
void | mi::math::Matrix<T, ROW, COL>::rotate (const Vector< Float32, 3 > &angles) |
Adds a relative rotation to the matrix (Euler angles, by vector). More... | |
void | mi::math::Matrix<T, ROW, COL>::rotate (const Vector< Float64, 3 > &angles) |
Adds a relative rotation to the matrix (Euler angles, by vector). More... | |
void | mi::math::Matrix<T, ROW, COL>::set_rotation (T x_angle, T y_angle, T z_angle) |
Stores an absolute rotation in the upper left 3x3 rotation matrix (Euler angles, by component). More... | |
void | mi::math::Matrix<T, ROW, COL>::set_rotation (const Vector< Float32, 3 > &angles) |
Stores an absolute rotation in the upper left 3x3 rotation matrix (Euler angles, by vector). More... | |
void | mi::math::Matrix<T, ROW, COL>::set_rotation (const Vector< Float64, 3 > &angles) |
Stores an absolute rotation in the upper left 3x3 rotation matrix (Euler angles, by vector). More... | |
void | mi::math::Matrix<T, ROW, COL>::set_rotation (const Vector< Float32, 3 > &axis, Float64 angle) |
Stores an absolute rotation (by axis and angle). More... | |
void | mi::math::Matrix<T, ROW, COL>::set_rotation (const Vector< Float64, 3 > &axis, Float64 angle) |
Stores an absolute rotation (by axis and angle). More... | |
void | mi::math::Matrix<T, ROW, COL>::lookat (const Vector< Float32, 3 > &position, const Vector< Float32, 3 > &target, const Vector< Float32, 3 > &up) |
Sets a transformation matrix based on a given center, a reference point, and a direction. More... | |
void | mi::math::Matrix<T, ROW, COL>::lookat (const Vector< Float64, 3 > &position, const Vector< Float64, 3 > &target, const Vector< Float64, 3 > &up) |
Sets a transformation matrix based on a given center, a reference point, and a direction. More... | |
template<typename T , Size ROW, Size COL> | |
bool | mi::math::operator== (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Returns true if lhs is elementwise equal to rhs . More... | |
template<typename T , Size ROW, Size COL> | |
bool | mi::math::operator!= (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Returns true if lhs is elementwise not equal to rhs . More... | |
template<typename T , Size ROW, Size COL> | |
bool | mi::math::operator< (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Returns true if lhs is lexicographically less than rhs . More... | |
template<typename T , Size ROW, Size COL> | |
bool | mi::math::operator<= (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Returns true if lhs is lexicographically less than or equal to rhs . More... | |
template<typename T , Size ROW, Size COL> | |
bool | mi::math::operator> (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Returns true if lhs is lexicographically greater than rhs . More... | |
template<typename T , Size ROW, Size COL> | |
bool | mi::math::operator>= (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Returns true if lhs is lexicographically greater than or equal to rhs . More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> & | mi::math::operator+= (Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Adds rhs elementwise to lhs and returns the modified lhs . More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> & | mi::math::operator-= (Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Subtracts rhs elementwise from lhs and returns the modified lhs . More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> | mi::math::operator+ (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Adds lhs and rhs elementwise and returns the new result. More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> | mi::math::operator- (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs) |
Subtracts rhs elementwise from lhs and returns the new result. More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> | mi::math::operator- (const Matrix<T, ROW, COL> &mat) |
Negates the matrix mat elementwise and returns the new result. More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> & | mi::math::operator*= (Matrix<T, ROW, COL> &lhs, const Matrix<T, COL, COL> &rhs) |
Performs matrix multiplication, lhs times rhs , assigns it to lhs , and returns the modified lhs . More... | |
template<typename T , Size ROW1, Size COL1, Size ROW2, Size COL2> | |
Matrix<T, ROW1, COL2> | mi::math::operator* (const Matrix<T, ROW1, COL1> &lhs, const Matrix<T, ROW2, COL2> &rhs) |
Performs matrix multiplication, lhs times rhs , and returns the new result. More... | |
template<typename T , Size ROW, Size COL, Size DIM> | |
Vector<T, ROW> | mi::math::operator* (const Matrix<T, ROW, COL> &mat, const Vector<T, DIM> &vec) |
Multiplies the (column) vector vec from the right with the matrix mat and returns the resulting vector. More... | |
template<Size DIM, typename T , Size ROW, Size COL> | |
Vector<T, COL> | mi::math::operator* (const Vector<T, DIM> &vec, const Matrix<T, ROW, COL> &mat) |
Multiplies the (row) vector vec from the left with the matrix mat and returns the resulting vector. More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> & | mi::math::operator*= (Matrix<T, ROW, COL> &mat, T factor) |
Multiplies the matrix mat elementwise with the scalar factor and returns the modified matrix mat . More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> | mi::math::operator* (const Matrix<T, ROW, COL> &mat, T factor) |
Multiplies the matrix mat elementwise with the scalar factor and returns the new result. More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, ROW, COL> | mi::math::operator* (T factor, const Matrix<T, ROW, COL> &mat) |
Multiplies the matrix mat elementwise with the scalar factor and returns the new result. More... | |
template<Size NEW_ROW, Size NEW_COL, typename T , Size ROW, Size COL> | |
Matrix< T, NEW_ROW, NEW_COL > | mi::math::sub_matrix (const Matrix<T, ROW, COL> &mat) |
Returns the upper-left sub-matrix of size NEW_ROW times NEW_COL . More... | |
template<typename T , Size ROW, Size COL> | |
Matrix<T, COL, ROW> | mi::math::transpose (const Matrix<T, ROW, COL> &mat) |
Returns the transpose of the matrix mat by exchanging rows and columns. More... | |
template<typename T , typename U> | |
U | mi::math::transform_point (const Matrix<T, 4, 4> &mat, const U &point) |
Returns a transformed 1D point by applying the full transformation in the 4x4 matrix mat on the 1D point point , which includes the translation. More... | |
template<typename T , typename U> | |
Vector<U, 2> | mi::math::transform_point (const Matrix<T, 4, 4> &mat, const Vector<U, 2> &point) |
Returns a transformed 2D point by applying the full transformation in the 4x4 matrix mat on the 2D point point , which includes the translation. More... | |
template<typename T , typename U> | |
Vector<U, 3> | mi::math::transform_point (const Matrix<T, 4, 3> &mat, const Vector<U, 3> &point) |
Returns a transformed 3D point by applying the full transformation in the 4x3 matrix mat on the 3D point point , which includes the translation. More... | |
template<typename T , typename U> | |
Vector<U, 3> | mi::math::transform_point (const Matrix<T, 4, 4> &mat, const Vector<U, 3> &point) |
Returns a transformed 3D point by applying the full transformation in the 4x4 matrix mat on the 3D point point , which includes the translation. More... | |
template<typename T , typename U> | |
Vector<U, 4> | mi::math::transform_point (const Matrix<T, 4, 4> &mat, const Vector<U, 4> &point) |
Returns a transformed 4D point by applying the full transformation in the 4x4 matrix mat on the 4D point point , which includes the translation. More... | |
template<typename T , typename U> | |
U | mi::math::transform_vector (const Matrix<T, 4, 4> &mat, const U &vector) |
Returns a transformed 1D vector by applying the 1x1 linear sub-transformation in the 4x4 matrix mat on the 1D vector vector , which excludes the translation. More... | |
template<typename T , typename U> | |
Vector<U, 2> | mi::math::transform_vector (const Matrix<T, 4, 4> &mat, const Vector<U, 2> &vector) |
Returns a transformed 2D vector by applying the 2x2 linear sub-transformation in the 4x4 matrix mat on the 2D vector vector , which excludes the translation. More... | |
template<typename T , typename U> | |
Vector<U, 3> | mi::math::transform_vector (const Matrix<T, 3, 3> &mat, const Vector<U, 3> &vector) |
Returns a transformed 3D vector by applying the 3x3 matrix mat transformation on the 3D vector vector . More... | |
template<typename T , typename U> | |
Vector<U, 3> | mi::math::transform_vector (const Matrix<T, 4, 3> &mat, const Vector<U, 3> &vector) |
Returns a transformed 3D vector by applying the 3x3 linear sub-transformation in the 4x3 matrix mat on the 3D vector vector , which excludes the translation. More... | |
template<typename T , typename U> | |
Vector<U, 3> | mi::math::transform_vector (const Matrix<T, 4, 4> &mat, const Vector<U, 3> &vector) |
Returns a transformed 3D vector by applying the 3x3 linear sub-transformation in the 4x4 matrix mat on the 3D vector vector , which excludes the translation. More... | |
template<typename T , typename U> | |
Vector<U, 3> | mi::math::transform_normal_inv (const Matrix<T, 3, 3> &inv_mat, const Vector<U, 3> &normal) |
Returns an inverse transformed 3D normal vector by applying the 3x3 transposed linear transformation in the matrix inv_mat on the 3D normal vector normal . More... | |
template<typename T , typename U> | |
Vector<U, 3> | mi::math::transform_normal_inv (const Matrix<T, 4, 4> &inv_mat, const Vector<U, 3> &normal) |
Returns an inverse transformed 3D normal vector by applying the 3x3 transposed linear sub-transformation in the 4x4 matrix inv_mat on the 3D normal vector normal . More... | |
template<typename T , typename U> | |
Vector<U, 3> | mi::math::transform_normal (const Matrix<T, 4, 4> &mat, const Vector<U, 3> &normal) |
Returns a transformed 3D normal vector by applying the 3x3 transposed linear sub-transformation in the inverse of the 4x4 matrix mat on the 3D normal vector normal . More... | |
Storage class for matrix templates with support for xx
, xy
, xz
, etc., members for appropriate dimensions.
Use the mi::math::Matrix template in your programs and this storage class only if you need a POD type, for example for parameter passing.
#include <mi/math/matrix.h>
typedef Vector<T,ROW> mi::math::Matrix<T, ROW, COL>::Column_vector |
Associated column vector of dimension ROW
.
typedef const T* mi::math::Matrix<T, ROW, COL>::const_pointer |
Const pointer to element.
typedef const T& mi::math::Matrix<T, ROW, COL>::const_reference |
Const reference to element.
typedef Difference mi::math::Matrix<T, ROW, COL>::difference_type |
Difference type, signed.
typedef Matrix_struct<T,ROW,COL> mi::math::Matrix<T, ROW, COL>::Pod_type |
POD class corresponding to this matrix.
typedef T* mi::math::Matrix<T, ROW, COL>::pointer |
Mutable pointer to element.
typedef T& mi::math::Matrix<T, ROW, COL>::reference |
Mutable reference to element.
typedef Vector<T,COL> mi::math::Matrix<T, ROW, COL>::Row_vector |
Associated row vector of dimension COL
.
typedef Size mi::math::Matrix<T, ROW, COL>::size_type |
Size type, unsigned.
typedef Matrix_struct<T,ROW,COL> mi::math::Matrix<T, ROW, COL>::storage_type |
Storage class used by this matrix.
typedef T mi::math::Matrix<T, ROW, COL>::value_type |
Element type.
|
inline |
Returns the pointer to the first matrix element.
|
inline |
Returns the pointer to the first matrix element.
|
inline |
Returns the determinant of the upper-left 3x3 sub-matrix.
ROW==3
or ROW==4
) and (COL==3
or COL==4
)
|
inline |
|
inline |
|
inline |
Accesses the i-th
matrix element, indexed in the order of the row-major memory layout.
0 <= i < ROW*COL
|
inline |
Accesses the (row
, col
)-th matrix element.
0 <= row < ROW
and 0 <= col < COL
|
inline |
Inverts this matrix and returns success or failure.
The matrix cannot be inverted if it is singular or if it is non-square.
|
inline |
Sets a transformation matrix based on a given center, a reference point, and a direction.
The transformation is computed such that position
is mapped to the origin, target
is mapped to the negative Z-axis, and the up
direction is mapped to the positive Y-axis.
|
inline |
Sets a transformation matrix based on a given center, a reference point, and a direction.
The transformation is computed such that the origin is mapped to position
, the negative Z-axis is mapped to the target
direction, and the positive Y-axis is mapped to the up
direction.
|
inline |
The default constructor leaves the vector elements uninitialized.
|
default |
Default copy constructor.
|
inlineexplicit |
Template constructor that allows explicit conversions from other matrices with assignment compatible element value type.
|
inline |
Constructor from underlying storage type.
|
inlineexplicit |
Template constructor that allows explicit conversions from underlying storage type with assignment compatible element value type.
|
inlineexplicit |
Dedicated constructor, for ROW==1
only, that initializes matrix from one row vector v0
.
ROW == 1
|
inline |
Dedicated constructor, for ROW==2
only, that initializes matrix from two row vectors (v0,v1).
ROW == 2
|
inline |
Dedicated constructor, for ROW==3
only, that initializes matrix from three row vectors (v0,v1,v2).
ROW == 3
|
inline |
Dedicated constructor, for ROW==4
only, that initializes matrix from four row vectors (v0,v1,v2,v3).
ROW == 4
|
inline |
Constructor requires the mi::math::FROM_ITERATOR tag as first argument and initializes the matrix elements with the first ROW
times COL
elements from the sequence starting at the iterator p
.
Iterator
must be a model of an input iterator. The value type of Iterator
must be assignment compatible with the matrix elements type T
.
An example:
|
inlineexplicit |
Constructor initializes all matrix elements to zero and the diagonal elements to diag
.
Examples are diag==0
to create the null matrix and diag==1
to create the unit matrix.
diag | value for diagonal elements. |
|
inline |
2-element constructor, must be a 1x2 or 2x1 matrix.
The elements are given in row-major order.
|
inline |
3-element constructor, must be a 1x3 or 3x1 matrix.
The elements are given in row-major order.
|
inline |
4-element constructor, must be a 1x4, 2x2, or 4x1 matrix.
The elements are given in row-major order.
|
inline |
6-element constructor, must be a 2x3 or 3x2 matrix.
The elements are given in row-major order.
|
inline |
8-element constructor, must be a 2x4 or 4x2 matrix.
The elements are given in row-major order.
|
inline |
9-element constructor, must be a 3x3 matrix.
The elements are given in row-major order.
|
inline |
12-element constructor, must be a 3x4 or 4x3 matrix.
The elements are given in row-major order.
|
inline |
16-element constructor, must be a 4x4 matrix.
The elements are given in row-major order.
|
inlineexplicit |
Constructor initializes the matrix elements from an array
of dimension ROW
times COL
.
The value type T2
of the array
must be assignment compatible with the matrix elements type T
.
An example that initializes a 2x2 unit matrix from an array:
|
inline |
Constructor that initializes the matrix with the transpose matrix of other
.
|
inline |
Template constructor that initializes the matrix with the transpose matrix of other
that allows the explicit conversions from other matrices with assignment compatible element value type.
|
inline |
Returns the base pointer to the matrix data.
|
inline |
Returns the base pointer to the matrix data.
|
inlinestatic |
Constant maximum size of the vector.
|
inline |
Returns true
if lhs
is elementwise not equal to rhs
.
|
inline |
Accesses the (row
,col
)-th matrix element.
0 <= row < ROW
and 0 <= col < COL
|
inline |
Accesses the (row
, col
)-th matrix element.
0 <= row < ROW
and 0 <= col < COL
|
inline |
Multiplies the (column) vector vec
from the right with the matrix mat
and returns the resulting vector.
The result vector has the same dimension as the number of rows in the matrix mat
.
vec
must have the same dimension as the number of columns in the matrix mat
. Multiplies the matrix mat
elementwise with the scalar factor
and returns the new result.
|
inline |
Performs matrix multiplication, lhs
times rhs
, and returns the new result.
The matrices can be of different sizes, but the number of columns of lhs
must be equal to the number of rows of rhs
. The result matrix has then the size (number of rows of lhs
) times (number of columns of rhs
).
|
inline |
Multiplies the (row) vector vec
from the left with the matrix mat
and returns the resulting vector.
The result vector has the same dimension as the number of columns in the matrix mat
.
vec
must have the same dimension as the number of rows in the matrix mat
. Multiplies the matrix mat
elementwise with the scalar factor
and returns the new result.
|
inline |
Performs matrix multiplication, lhs
times rhs
, assigns it to lhs
, and returns the modified lhs
.
The matrix lhs
must be of size ROW
times COL
, and the matrix rhs
must be of size COL
times COL
. For mixed size matrix multiplications, see the mi::math::operator*() on matrices.
Multiplies the matrix mat
elementwise with the scalar factor
and returns the modified matrix mat
.
|
inline |
Adds lhs
and rhs
elementwise and returns the new result.
Matrix<T, ROW, COL> & mi::math::operator+= | ( | Matrix<T, ROW, COL> & | lhs, |
const Matrix<T, ROW, COL> & | rhs | ||
) |
Adds rhs
elementwise to lhs
and returns the modified lhs
.
|
inline |
Subtracts rhs
elementwise from lhs
and returns the new result.
Negates the matrix mat
elementwise and returns the new result.
Matrix<T, ROW, COL> & mi::math::operator-= | ( | Matrix<T, ROW, COL> & | lhs, |
const Matrix<T, ROW, COL> & | rhs | ||
) |
Subtracts rhs
elementwise from lhs
and returns the modified lhs
.
|
inline |
Returns true
if lhs
is lexicographically less than rhs
.
|
inline |
Returns true
if lhs
is lexicographically less than or equal to rhs
.
|
inline |
Assignment.
|
inline |
Returns true
if lhs
is elementwise equal to rhs
.
|
inline |
Returns true
if lhs
is lexicographically greater than rhs
.
|
inline |
Returns true
if lhs
is lexicographically greater than or equal to rhs
.
|
inline |
Accesses the row-th
row vector, 0 <= row < ROW
.
|
inline |
Accesses the row-th
row vector, 0 <= row < ROW
.
|
inline |
Adds a relative rotation to the matrix (Euler angles, by vector).
The rotation is given by XYZ Euler angles (in radians). The elements in the last column of the matrix remain unchanged.
|
inline |
Adds a relative rotation to the matrix (Euler angles, by vector).
The rotation is given by XYZ Euler angles (in radians). The elements in the last column of the matrix remain unchanged.
|
inline |
Adds a relative rotation to the matrix (Euler angles, by component).
The rotation is given by XYZ Euler angles (in radians). The elements in the last column of the matrix remain unchanged.
|
inline |
Sets the i-th
matrix element to value
, indexed in the order of the row-major memory layout.
0 <= i < ROW*COL
|
inline |
Sets the i-th
matrix element to value
, indexed in the order of the row-major memory layout.
0 <= row < ROW
and 0 <= col < COL
|
inline |
Stores an absolute rotation in the upper left 3x3 rotation matrix (Euler angles, by vector).
The rotation is given by XYZ Euler angles (in radians). The other matrix elements remain unchanged.
|
inline |
Stores an absolute rotation (by axis and angle).
The computed rotation matrix describes a rotation by the given angle (in radians) around the given axis. The other matrix elements are set to 0 and 1, respectively.
axis
is normalized
|
inline |
Stores an absolute rotation in the upper left 3x3 rotation matrix (Euler angles, by vector).
The rotation is given by XYZ Euler angles (in radians). The other matrix elements remain unchanged.
|
inline |
Stores an absolute rotation (by axis and angle).
The computed rotation matrix describes a rotation by the given angle (in radians) around the given axis. The other matrix elements are set to 0 and 1, respectively.
axis
is normalized
|
inline |
Stores an absolute rotation in the upper left 3x3 rotation matrix (Euler angles, by component).
The rotation is given by XYZ Euler angles (in radians). The other matrix elements remain unchanged.
|
inline |
Stores an absolute translation in the matrix (by vector).
The other matrix elements remain unchanged.
|
inline |
Stores an absolute translation in the matrix (by vector).
The other matrix elements remain unchanged.
|
inline |
Stores an absolute translation in the matrix (by component).
The other matrix elements remain unchanged.
|
inlinestatic |
Constant size of the vector.
Returns the upper-left sub-matrix of size NEW_ROW
times NEW_COL
.
NEW_ROW
<= ROW
and NEW_COL
<= COL
.
|
inline |
Returns a transformed 3D normal vector by applying the 3x3 transposed linear sub-transformation in the inverse of the 4x4 matrix mat
on the 3D normal vector normal
.
Note that in general, a normal vector is transformed by the transposed inverse matrix (compared to a point transformation) and the inverse is often costly to compute. So, if you wish to compute the inverse once and keep it to transform several normal vectors, you can use the mi::math::transform_normal_inv() function, which accepts the inverse matrix as argument.
If the linear sub-matrix cannot be inverted, this function returns the unchanged normal
.
The normal vector normal
is considered to be a row vector, which is multiplied from the left with the transposed upper-left 3x3 sub-matrix of the inverse of mat
.
mat | 4x4 transformation matrix |
normal | normal vector to transform |
|
inline |
Returns an inverse transformed 3D normal vector by applying the 3x3 transposed linear transformation in the matrix inv_mat
on the 3D normal vector normal
.
Note that in general, a normal vector is transformed by the transposed inverse matrix (compared to a point transformation). The inverse is often costly to compute, why one typically keeps the inverse stored and this function operates then on the inverse matrix to properly transform normal vectors. If you need to transform only one normal, you can also consider the mi::math::transform_normal() function, which includes the inverse computation.
The normal vector normal
is considered to be a row vector, which is multiplied from the left with the transposed upper-left 3x3 sub-matrix of inv_mat
.
inv_mat | inverse 4x4 transformation matrix |
normal | normal vector to transform |
|
inline |
Returns an inverse transformed 3D normal vector by applying the 3x3 transposed linear sub-transformation in the 4x4 matrix inv_mat
on the 3D normal vector normal
.
Note that in general, a normal vector is transformed by the transposed inverse matrix (compared to a point transformation). The inverse is often costly to compute, why one typically keeps the inverse stored and this function operates then on the inverse matrix to properly transform normal vectors. If you need to transform only one normal, you can also consider the mi::math::transform_normal() function, which includes the inverse computation.
The normal vector normal
is considered to be a row vector, which is multiplied from the left with the transposed upper-left 3x3 sub-matrix of inv_mat
.
inv_mat | inverse 4x4 transformation matrix |
normal | normal vector to transform |
|
inline |
Returns a transformed 3D point by applying the full transformation in the 4x3 matrix mat
on the 3D point point
, which includes the translation.
The point point
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x3 transformation matrix |
point | point to transform |
|
inline |
Returns a transformed 1D point by applying the full transformation in the 4x4 matrix mat
on the 1D point point
, which includes the translation.
The point point
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x4 transformation matrix |
point | point to transform |
|
inline |
Returns a transformed 2D point by applying the full transformation in the 4x4 matrix mat
on the 2D point point
, which includes the translation.
The point point
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x4 transformation matrix |
point | point to transform |
|
inline |
Returns a transformed 3D point by applying the full transformation in the 4x4 matrix mat
on the 3D point point
, which includes the translation.
The point point
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x4 transformation matrix |
point | point to transform |
|
inline |
Returns a transformed 4D point by applying the full transformation in the 4x4 matrix mat
on the 4D point point
, which includes the translation.
The point point
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x4 transformation matrix |
point | point to transform |
|
inline |
Returns a transformed 3D vector by applying the 3x3 matrix mat
transformation on the 3D vector vector
.
The vector vector
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 3x3 transformation matrix |
vector | vector to transform |
|
inline |
Returns a transformed 3D vector by applying the 3x3 linear sub-transformation in the 4x3 matrix mat
on the 3D vector vector
, which excludes the translation.
The vector vector
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x3 transformation matrix |
vector | vector to transform |
|
inline |
Returns a transformed 1D vector by applying the 1x1 linear sub-transformation in the 4x4 matrix mat
on the 1D vector vector
, which excludes the translation.
The vector vector
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x4 transformation matrix |
vector | vector to transform |
|
inline |
Returns a transformed 2D vector by applying the 2x2 linear sub-transformation in the 4x4 matrix mat
on the 2D vector vector
, which excludes the translation.
The vector vector
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x4 transformation matrix |
vector | vector to transform |
|
inline |
Returns a transformed 3D vector by applying the 3x3 linear sub-transformation in the 4x4 matrix mat
on the 3D vector vector
, which excludes the translation.
The vector vector
is considered to be a row vector, which is multiplied from the left with the matrix mat
.
mat | 4x4 transformation matrix |
vector | vector to transform |
|
inline |
Adds a relative translation to the matrix (by vector).
The other matrix elements remain unchanged.
|
inline |
Adds a relative translation to the matrix (by vector).
The other matrix elements remain unchanged.
|
inline |
Adds a relative translation to the matrix (by components).
The other matrix elements remain unchanged.
|
inline |
Transposes this matrix by exchanging rows and columns.
COL
For transposing non-square matrices see the mi::math::transpose() function.
Returns the transpose of the matrix mat
by exchanging rows and columns.
|
static |
Constant number of columns of the matrix.
T mi::math::Matrix_struct<T, ROW, COL>::elements[ROW *COL] |
general case matrix elements.
|
static |
Constant number of rows of the matrix.
|
static |
Constant size of the matrix.
T mi::math::Matrix_struct<T, 4, 4>::ww |
ww-element.
T mi::math::Matrix_struct<T, 4, 1>::wx |
wx-element.
T mi::math::Matrix_struct<T, 4, 2>::wx |
wx-element.
T mi::math::Matrix_struct<T, 4, 3>::wx |
wx-element.
T mi::math::Matrix_struct<T, 4, 4>::wx |
wx-element.
T mi::math::Matrix_struct<T, 4, 2>::wy |
wy-element.
T mi::math::Matrix_struct<T, 4, 3>::wy |
wy-element.
T mi::math::Matrix_struct<T, 4, 4>::wy |
wy-element.
T mi::math::Matrix_struct<T, 4, 3>::wz |
wz-element.
T mi::math::Matrix_struct<T, 4, 4>::wz |
wz-element.
T mi::math::Matrix_struct<T, 1, 4>::xw |
xw-element.
T mi::math::Matrix_struct<T, 2, 4>::xw |
xw-element.
T mi::math::Matrix_struct<T, 3, 4>::xw |
xw-element.
T mi::math::Matrix_struct<T, 4, 4>::xw |
xw-element.
T mi::math::Matrix_struct<T, 1, 1>::xx |
xx-element.
T mi::math::Matrix_struct<T, 2, 1>::xx |
xx-element.
T mi::math::Matrix_struct<T, 3, 1>::xx |
xx-element.
T mi::math::Matrix_struct<T, 4, 1>::xx |
xx-element.
T mi::math::Matrix_struct<T, 1, 2>::xx |
xx-element.
T mi::math::Matrix_struct<T, 2, 2>::xx |
xx-element.
T mi::math::Matrix_struct<T, 3, 2>::xx |
xx-element.
T mi::math::Matrix_struct<T, 4, 2>::xx |
xx-element.
T mi::math::Matrix_struct<T, 1, 3>::xx |
xx-element.
T mi::math::Matrix_struct<T, 2, 3>::xx |
xx-element.
T mi::math::Matrix_struct<T, 3, 3>::xx |
xx-element.
T mi::math::Matrix_struct<T, 4, 3>::xx |
xx-element.
T mi::math::Matrix_struct<T, 1, 4>::xx |
xx-element.
T mi::math::Matrix_struct<T, 2, 4>::xx |
xx-element.
T mi::math::Matrix_struct<T, 3, 4>::xx |
xx-element.
T mi::math::Matrix_struct<T, 4, 4>::xx |
xx-element.
T mi::math::Matrix_struct<T, 1, 2>::xy |
xy-element.
T mi::math::Matrix_struct<T, 2, 2>::xy |
xy-element.
T mi::math::Matrix_struct<T, 3, 2>::xy |
xy-element.
T mi::math::Matrix_struct<T, 4, 2>::xy |
xy-element.
T mi::math::Matrix_struct<T, 1, 3>::xy |
xy-element.
T mi::math::Matrix_struct<T, 2, 3>::xy |
xy-element.
T mi::math::Matrix_struct<T, 3, 3>::xy |
xy-element.
T mi::math::Matrix_struct<T, 4, 3>::xy |
xy-element.
T mi::math::Matrix_struct<T, 1, 4>::xy |
xy-element.
T mi::math::Matrix_struct<T, 2, 4>::xy |
xy-element.
T mi::math::Matrix_struct<T, 3, 4>::xy |
xy-element.
T mi::math::Matrix_struct<T, 4, 4>::xy |
xy-element.
T mi::math::Matrix_struct<T, 1, 3>::xz |
xz-element.
T mi::math::Matrix_struct<T, 2, 3>::xz |
xz-element.
T mi::math::Matrix_struct<T, 3, 3>::xz |
xz-element.
T mi::math::Matrix_struct<T, 4, 3>::xz |
xz-element.
T mi::math::Matrix_struct<T, 1, 4>::xz |
xz-element.
T mi::math::Matrix_struct<T, 2, 4>::xz |
xz-element.
T mi::math::Matrix_struct<T, 3, 4>::xz |
xz-element.
T mi::math::Matrix_struct<T, 4, 4>::xz |
xz-element.
T mi::math::Matrix_struct<T, 2, 4>::yw |
yw-element.
T mi::math::Matrix_struct<T, 3, 4>::yw |
yw-element.
T mi::math::Matrix_struct<T, 4, 4>::yw |
yw-element.
T mi::math::Matrix_struct<T, 2, 1>::yx |
yx-element.
T mi::math::Matrix_struct<T, 3, 1>::yx |
yx-element.
T mi::math::Matrix_struct<T, 4, 1>::yx |
yx-element.
T mi::math::Matrix_struct<T, 2, 2>::yx |
yx-element.
T mi::math::Matrix_struct<T, 3, 2>::yx |
yx-element.
T mi::math::Matrix_struct<T, 4, 2>::yx |
yx-element.
T mi::math::Matrix_struct<T, 2, 3>::yx |
yx-element.
T mi::math::Matrix_struct<T, 3, 3>::yx |
yx-element.
T mi::math::Matrix_struct<T, 4, 3>::yx |
yx-element.
T mi::math::Matrix_struct<T, 2, 4>::yx |
yx-element.
T mi::math::Matrix_struct<T, 3, 4>::yx |
yx-element.
T mi::math::Matrix_struct<T, 4, 4>::yx |
yx-element.
T mi::math::Matrix_struct<T, 2, 2>::yy |
yy-element.
T mi::math::Matrix_struct<T, 3, 2>::yy |
yy-element.
T mi::math::Matrix_struct<T, 4, 2>::yy |
yy-element.
T mi::math::Matrix_struct<T, 2, 3>::yy |
yy-element.
T mi::math::Matrix_struct<T, 3, 3>::yy |
yy-element.
T mi::math::Matrix_struct<T, 4, 3>::yy |
yy-element.
T mi::math::Matrix_struct<T, 2, 4>::yy |
yy-element.
T mi::math::Matrix_struct<T, 3, 4>::yy |
yy-element.
T mi::math::Matrix_struct<T, 4, 4>::yy |
yy-element.
T mi::math::Matrix_struct<T, 2, 3>::yz |
yz-element.
T mi::math::Matrix_struct<T, 3, 3>::yz |
yz-element.
T mi::math::Matrix_struct<T, 4, 3>::yz |
yz-element.
T mi::math::Matrix_struct<T, 2, 4>::yz |
yz-element.
T mi::math::Matrix_struct<T, 3, 4>::yz |
yz-element.
T mi::math::Matrix_struct<T, 4, 4>::yz |
yz-element.
T mi::math::Matrix_struct<T, 3, 4>::zw |
zw-element.
T mi::math::Matrix_struct<T, 4, 4>::zw |
zw-element.
T mi::math::Matrix_struct<T, 3, 1>::zx |
zx-element.
T mi::math::Matrix_struct<T, 4, 1>::zx |
zx-element.
T mi::math::Matrix_struct<T, 3, 2>::zx |
zx-element.
T mi::math::Matrix_struct<T, 4, 2>::zx |
zx-element.
T mi::math::Matrix_struct<T, 3, 3>::zx |
zx-element.
T mi::math::Matrix_struct<T, 4, 3>::zx |
zx-element.
T mi::math::Matrix_struct<T, 3, 4>::zx |
zx-element.
T mi::math::Matrix_struct<T, 4, 4>::zx |
zx-element.
T mi::math::Matrix_struct<T, 3, 2>::zy |
zy-element.
T mi::math::Matrix_struct<T, 4, 2>::zy |
zy-element.
T mi::math::Matrix_struct<T, 3, 3>::zy |
zy-element.
T mi::math::Matrix_struct<T, 4, 3>::zy |
zy-element.
T mi::math::Matrix_struct<T, 3, 4>::zy |
zy-element.
T mi::math::Matrix_struct<T, 4, 4>::zy |
zy-element.
T mi::math::Matrix_struct<T, 3, 3>::zz |
zz-element.
T mi::math::Matrix_struct<T, 4, 3>::zz |
zz-element.
T mi::math::Matrix_struct<T, 3, 4>::zz |
zz-element.
T mi::math::Matrix_struct<T, 4, 4>::zz |
zz-element.