Honeycomb  0.1
Component-Model Framework
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
honey::Matrix< 4, 4, Real, Options > Class Template Reference

4x4 homogeneous matrix class. Supports both affine and projective operations. More...

#include <Matrix4.h>

Inheritance diagram for honey::Matrix< 4, 4, Real, Options >:
Inheritance graph
[legend]
Collaboration diagram for honey::Matrix< 4, 4, Real, Options >:
Collaboration graph
[legend]

Public Types

typedef Vec< s_rows, RealVecCol
 
typedef Vec< s_cols, Real, matrix::Option::vecRowVecRow
 
- Public Types inherited from honey::MatrixBase< Matrix< 4, 4, Real, Options > >
typedef Matrix< 4, 4, Real, Options > MatrixS
 
typedef Vec< s_rows, RealVecCol
 
typedef Vec< s_cols, Real, matrix::Option::vecRow > VecRow
 

Public Member Functions

 Matrix ()
 No init. More...
 
 Matrix (Real _00, Real _01, Real _02, Real _03, Real _10, Real _11, Real _12, Real _13, Real _20, Real _21, Real _22, Real _23, Real _30, Real _31, Real _32, Real _33)
 Construct from values. More...
 
 Matrix (Real scalar)
 Initialize with scalar in every element. More...
 
 Matrix (const Real *a, sdt rows, sdt cols, bool rowMajor=true)
 Initialize from array with dimensions (rows x cols). If the array is in row-major format set rowMajor to true, otherwise set to false for column-major. More...
 
 Matrix (const Quat &q)
 Construct from quaternion. More...
 
 Matrix (const Transform &tm)
 Initialize from transform. More...
 
template<class T >
 Matrix (const MatrixBase< T > &rhs)
 Construct from matrix of same size. More...
 
template<class T >
Matrix< s_rows, T::s_cols, Realoperator* (const T &rhs) const
 Forward to base. More...
 
Matrix operator* (Real rhs) const
 
MatrixfromIdentity ()
 Make matrix identity. More...
 
MatrixfromTrs (const Vec3 &trans, const Quat &rot=Quat::identity, const Vec3 &scale=Vec3::one, const Quat &skew=Quat::identity)
 Init from translation, rotation, scale and skew. More...
 
MatrixfromScalar (Real f)
 Initialize with scalar in every element. More...
 
MatrixfromTm (const Transform &tm)
 Initialize from transform. More...
 
MatrixfromObliqueProjection (const Vec3 &normal, const Vec3 &point, const Vec3 &dir)
 Construct a matrix that represents a projection onto a plane along a direction. More...
 
MatrixfromPerspectiveProjection (const Vec3 &normal, const Vec3 &point, const Vec3 &eye)
 Construct a matrix that represents a perspective projection onto a plane. More...
 
MatrixfromReflection (const Vec3 &normal, const Vec3 &point)
 Construct a matrix that represents a reflection on a plane. More...
 
MatrixfromLookAt (const Vec3 &eye, const Vec3 &at, const Vec3 &up)
 Construct a matrix suitable for a camera. More...
 
template<class T >
Matrixoperator= (const MatrixBase< T > &rhs)
 Assign to matrix of same size. More...
 
Matrixmul (const Matrix &rhs, Matrix &res) const
 
Matrix && mul (const Matrix &rhs, Matrix &&res) const
 
VecCol operator* (const VecCol &v) const
 Square matrix, so multiplying a column vector on the right returns a column vector of the same dimension. More...
 
Vec3 operator* (const Vec3 &v) const
 Assumes vector has w = 1, transforms and projects result back into w = 1. More...
 
Vec2 operator* (const Vec2 &v) const
 Assumes vector has (z,w) = (0,1), transforms and projects result back into w = 1. More...
 
Vec3 mulAffine (const Vec3 &v) const
 Transform vector with affine part of matrix (apply pos/rot/scale). Same as operator*() but without projection back into w = 1. More...
 
Vec3 mulRotScale (const Vec3 &v) const
 Transform vector with upper-left 3x3 rot/scale sub-matrix (no translation) More...
 
Matrixtranspose (Matrix &res) const
 
Matrix && transpose (Matrix &&res) const
 
void transposeInPlace ()
 
MatrixtransposeMul (const Matrix &rhs, Matrix &res) const
 
Matrix && transposeMul (const Matrix &rhs, Matrix &&res) const
 
MatrixmulTranspose (const Matrix &rhs, Matrix &res) const
 
Matrix && mulTranspose (const Matrix &rhs, Matrix &&res) const
 
MatrixtransposeMulTranspose (const Matrix &rhs, Matrix &res) const
 
Matrix && transposeMulTranspose (const Matrix &rhs, Matrix &&res) const
 
void orthonormalize ()
 Gram-Schmidt orthonormalization on upper-left 3x3 submatrix. Useful for re-normalizing an orthonormal basis to eliminate rounding errors. More...
 
Matrix inverse (optional< Real & > det=optnull) const
 Get the inverse of this matrix. The determinant will be returned in det if specified. More...
 
Matrix adjugate () const
 The adjugate matrix is the transpose of the cofactor matrix (used in inversion) More...
 
Real determinant () const
 Get the determinant. More...
 
void decompose (optional< Vec3 & > trans=optnull, optional< Quat & > rot=optnull, optional< Vec3 & > scale=optnull, optional< Quat & > skew=optnull) const
 Decompose matrix into translation, rotation, scale and skew. More...
 
Vec3 getTrans () const
 Get translation. More...
 
void setTrans (const Vec3 &v)
 Set translation. More...
 
Quat getRot () const
 Get rotation. Beware: bogus if mat contains scale/skew. More...
 
void setRot (const Quat &q)
 Set rotation. Beware: overwrites scale/skew. More...
 
Vec3 getScale () const
 Get scale. Beware: bogus if mat contains rot/skew. More...
 
void setScale (const Vec3 &v, const Quat &skew=Quat::identity)
 Set scale. Beware: overwrites rotation. More...
 
void setScale (Real f)
 Set uniform scale. Beware: overwrites rotation. More...
 
Matrixtranslate (const Vec3 &v)
 Make a tm that performs this transform first, then does a translation. ie. T * This. More...
 
MatrixpreTranslate (const Vec3 &v)
 Make a tm that does a translation first, then performs this transform. ie. This * T. More...
 
Matrixrotate (const Quat &q)
 Make a tm that performs this transform first, then does a rotation. ie. R * This. More...
 
MatrixpreRotate (const Quat &q)
 Make a tm that does a rotation first, then performs this transform. ie. This * R. More...
 
Matrixscale (const Vec3 &v, const Quat &skew=Quat::identity)
 Make a tm that performs this transform first, then does a scale. ie. S * This. More...
 
Matrixscale (Real f)
 Uniform scale. More...
 
MatrixpreScale (const Vec3 &v, const Quat &skew=Quat::identity)
 Make a tm that does a scale first, then performs this transform. ie. This * S. More...
 
MatrixpreScale (Real f)
 Uniform prescale. More...
 
- Public Member Functions inherited from honey::MatrixBase< Matrix< 4, 4, Real, Options > >
MatrixSfromArray (const Num *a, bool rowMajor=true)
 Initialize from array. If the array is in row-major format set rowMajor to true, otherwise set to false for column-major. More...
 
MatrixSfromArray (const Real *a, bool rowMajor=true)
 
MatrixSfromZero ()
 Zero all elements. More...
 
MatrixSfromScalar (Real f)
 Initialize with scalar in every element. More...
 
MatrixSfromIdentity ()
 Make matrix identity. For non-square matrices the identity is in the upper-left square block, the rest is filled with zero. More...
 
matrix::Builder< MatrixSoperator<< (T &&val)
 Initialize matrix elements from scalars and other matrices using the comma operator: Matrix() << 1, 2, vec*5 ... The number of assigned elements must total up to be the matrix size exactly. More...
 
MatrixBaseoperator= (const MatrixBase< T > &rhs)
 Assign to matrix of any size. Asserts that any fixed dimensions in this matrix match those in rhs. More...
 
Matrix cast ()
 Convert to a matrix of another real type. More...
 
bool operator== (const MatrixBase< T > &rhs) const
 
bool operator!= (const MatrixBase< T > &rhs) const
 
bool operator< (const MatrixBase< T > &rhs) const
 
bool operator> (const MatrixBase< T > &rhs) const
 
bool operator<= (const MatrixBase< T > &rhs) const
 
bool operator>= (const MatrixBase< T > &rhs) const
 
Res && add (const T &rhs, Res &&res) const
 Add another matrix. Stores result in and returns res. res may reference the same matrix as this or rhs. More...
 
MatrixS operator+ () const
 
MatrixS operator+ (const MatrixBase< T > &rhs) const
 
MatrixSoperator+= (const MatrixBase< T > &rhs)
 
Res && sub (const T &rhs, Res &&res) const
 Subtract another matrix. Stores result in and returns res. res may reference the same matrix as this or rhs. More...
 
MatrixS operator- () const
 
MatrixS operator- (const MatrixBase< T > &rhs) const
 
MatrixSoperator-= (const MatrixBase< T > &rhs)
 
Res && mul (const T &rhs, Res &&res) const
 Multiply with another matrix. This mat's column size must match rhs' row size. Stores result in and returns res. Complexity: $ O(m n\ rhs_n) $. More...
 
Matrix< s_rows, T::s_cols, Realoperator* (const T &rhs) const
 Multiply with another matrix. Returns a new matrix. More...
 
MatrixS operator* (Real rhs) const
 
MatrixSoperator*= (const MatrixBase< T > &rhs)
 
MatrixSoperator*= (Real rhs)
 
MatrixS operator/ (Real rhs) const
 
MatrixSoperator/= (Real rhs)
 
MatrixS elemAdd (Real rhs) const
 Add rhs to each element. Returns a new matrix with the results. More...
 
MatrixSelemAddEq (Real rhs)
 Add rhs to each element. More...
 
MatrixS elemSub (Real rhs) const
 Subtract rhs from each element. Returns a new matrix with the results. More...
 
MatrixSelemSubEq (Real rhs)
 Subtract rhs from each element. More...
 
MatrixS elemMul (const MatrixBase< T > &rhs) const
 Multiply each element with its corresponding element in rhs. Returns a new matrix with the results. More...
 
MatrixSelemMulEq (const MatrixBase< T > &rhs)
 Multiply each element with its corresponding element in rhs. More...
 
MatrixS elemDiv (const MatrixBase< T > &rhs) const
 Divide each element by its corresponding element in rhs. Returns a new matrix with the results. More...
 
MatrixSelemDivEq (const MatrixBase< T > &rhs)
 Divide each element by its corresponding element in rhs. More...
 
MatrixS elemAbs () const
 Get the absolute value of each element. Returns a new matrix with the results. More...
 
MatrixS elemSqr () const
 Square each element. Returns a new matrix with the results. More...
 
MatrixS elemInverse () const
 Inverse each element. Returns a new matrix with the results. More...
 
MatrixS elemMin (const MatrixBase< T > &rhs) const
 Get the min of each element and its corresponding element in rhs. Returns a new matrix with the results. More...
 
MatrixS elemMax (const MatrixBase< T > &rhs) const
 Get the max of each element and its corresponding element in rhs. Returns a new matrix with the results. More...
 
bool isZero () const
 Check if each element is exactly zero. More...
 
bool isNearZero (Real tol=Real_::zeroTol) const
 Check if each element is close to zero. More...
 
MatrixS clamp (const MatrixBase< T > &min, const MatrixBase< T > &max) const
 Clamp each element between its corresponding elements in min and max. Returns a new matrix with the results. More...
 
Real sum () const
 Get the sum of all elements. More...
 
Real prod () const
 Get the product of all elements. More...
 
Real mean () const
 Get the mean of all elements. More...
 
Real min () const
 Get the minimum element. More...
 
Real max () const
 Get the maximum element. More...
 
matrix::Block< MatrixS, Rows, Cols > block (sdt row, sdt col, sdt rows=-1, sdt cols=-1)
 Get block at offset (row,col) with size (Rows, Cols). If Rows or Cols is fixed then rows or cols may be left unspecified. More...
 
matrix::Block< const MatrixS, Rows, Cols > block (sdt row, sdt col, sdt rows=-1, sdt cols=-1) const
 
matrix::Block< MatrixSblock (sdt row, sdt col, sdt rows, sdt cols)
 Get dynamic block at offset (row,col) with size (rows, cols) More...
 
matrix::Block< const MatrixSblock (sdt row, sdt col, sdt rows, sdt cols) const
 
matrix::Block< MatrixS, 1, s_cols > row (sdt row)
 Get row as a row vector. More...
 
matrix::Block< const MatrixS, 1, s_cols > row (sdt row) const
 
matrix::Block< MatrixS, s_rows, 1 > col (sdt col)
 Get column as a column vector. More...
 
matrix::Block< const MatrixS, s_rows, 1 > col (sdt col) const
 
MatrixSresize (sdt rows, sdt cols)
 Sets number of rows/columns and reallocates only if the size has changed (rows*cols). All previous data is lost on reallocation. Returns self. More...
 
matrix::Iter< MatrixSbegin ()
 Get an iterator over the elements in row-major order. More...
 
matrix::Iter< const MatrixSbegin () const
 
matrix::Iter< MatrixSend ()
 Get an iterator to the end of the iteration provided by begin() More...
 
matrix::Iter< const MatrixSend () const
 
matrix::Iter< MatrixSiter (sdt i)
 Get an iterator to the element at index. More...
 
matrix::Iter< const MatrixSiter (sdt i) const
 
matrix::Iter< MatrixSiter (sdt row, sdt col)
 Get an iterator to the element at (row, col) More...
 
matrix::Iter< const MatrixSiter (sdt row, sdt col) const
 
Num * toArray (Num *a, bool rowMajor=true) const
 Copy matrix into array. If the array is in row-major format set rowMajor to true, otherwise set to false for column-major. More...
 
RealtoArray (Real *a, bool rowMajor=true) const
 
Res && transpose (Res &&res) const
 $ M^T $ transpose and store result in res. Returns res. More...
 
Matrix< s_cols, s_rows, Realtranspose () const
 Returns new matrix. More...
 
void transposeInPlace ()
 transpose and store in this matrix, only valid for square matrices More...
 
Res && transposeMul (const T &rhs, Res &&res) const
 $ M^T * rhs $ Stores result in and returns res. More...
 
Matrix< s_cols, T::s_cols, RealtransposeMul (const T &rhs) const
 Returns new matrix. More...
 
Res && mulTranspose (const T &rhs, Res &&res) const
 $ M * rhs^T $ Stores result in and returns res. More...
 
Matrix< s_rows, T::s_rows, RealmulTranspose (const T &rhs) const
 Returns new matrix. More...
 
Res && transposeMulTranspose (const T &rhs, Res &&res) const
 $ M^T * rhs^T = (rhs*M)^T $ Stores result in and returns res. More...
 
Matrix< s_cols, T::s_rows, RealtransposeMulTranspose (const T &rhs) const
 Returns new matrix. More...
 
auto minor (sdt row, sdt col) const -> Matrix< (s_rows > 0)?s_rows-1:s_rows, (s_cols > 0)?s_cols-1:s_cols, Real >
 Returns a matrix without the selected row and column. More...
 
Matrix< s_cols, s_rows, Realinverse (optional< Real & > det=optnull) const
 Get the pseudo-inverse of this matrix. The pseudo-determinant will be returned in det if specified. More...
 
Real determinant () const
 Get the determinant. Returns the pseudo-determinant if this matrix is not square. More...
 
Real cond () const
 Get the condition value. A high value means the matrix is ill-conditioned and close to singular, so inversion and linear ops will be unreliable. More...
 

Static Public Attributes

static const Matrix zero
 
static const Matrix identity
 

Protected Member Functions

template<class Num >
MatrixfromColMajor (const Num *a)
 
template<class Num >
Num * toColMajor (Num *a) const
 
- Protected Member Functions inherited from honey::MatrixBase< Matrix< 4, 4, Real, Options > >
const Realm (sdt i) const
 Access matrix element at index. Wrapper for convenience only, more readable than (*this)(i) More...
 
Realm (sdt i)
 
const Realm (sdt row, sdt col) const
 Access matrix element with (row, column) More...
 
Realm (sdt row, sdt col)
 
MatrixSfromColMajor (const Num *a)
 
Num * toColMajor (Num *a) const
 

Friends

template<class T >
class MatrixBase
 
VecRow operator* (const VecRow &v, const Matrix &mat)
 Square matrix, so multiplying a row vector on the left returns a row vector of the same dimension. More...
 

Additional Inherited Members

- Protected Types inherited from honey::MatrixBase< Matrix< 4, 4, Real, Options > >
typedef matrix::priv::Traits< Matrix< 4, 4, Real, Options > >::Storage Storage
 
typedef Numeral< Real >::Real_ Real_
 
typedef Real_::DoubleType Double_
 
typedef Double_::Real Double
 
typedef Alge_< RealAlge
 
typedef Alge_< DoubleAlge_d
 
typedef Trig_< RealTrig
 
typedef Svd< RealSvd
 

Detailed Description

template<class Real, int Options>
class honey::Matrix< 4, 4, Real, Options >

4x4 homogeneous matrix class. Supports both affine and projective operations.

Matrix data is in row-major format. Transforms are applied on the left of column vectors (the standard way).

ie. To transform a column vector first by M0, followed by a transform of M1, apply: $ v' = M_1*(M_0*v) = M_1*M_0*v $

Matrix4::VecRow       Matrix4        Matrix4::VecCol (aka. Vec4)
[ x  y  z  w  ]   | 0  1  2  3  |   | x |
                * | 4  5  6  7  | * | y |
                  | 8  9  10 11 |   | z |
                  | 12 13 14 15 |   | w |

Affine matrix translation is in the last column: $ T(x,y,z) = [3,7,11] $

Member Typedef Documentation

template<class Real , int Options>
typedef Vec<s_rows, Real> honey::MatrixBase< Subclass >::VecCol
template<class Real , int Options>
typedef Vec<s_cols, Real, matrix::Option::vecRow> honey::MatrixBase< Subclass >::VecRow

Constructor & Destructor Documentation

template<class Real , int Options>
honey::Matrix< 4, 4, Real, Options >::Matrix ( )
inline

No init.

template<class Real , int Options>
honey::Matrix< 4, 4, Real, Options >::Matrix ( Real  _00,
Real  _01,
Real  _02,
Real  _03,
Real  _10,
Real  _11,
Real  _12,
Real  _13,
Real  _20,
Real  _21,
Real  _22,
Real  _23,
Real  _30,
Real  _31,
Real  _32,
Real  _33 
)
inline

Construct from values.

template<class Real , int Options>
honey::Matrix< 4, 4, Real, Options >::Matrix ( Real  scalar)
inlineexplicit

Initialize with scalar in every element.

template<class Real , int Options>
honey::Matrix< 4, 4, Real, Options >::Matrix ( const Real a,
sdt  rows,
sdt  cols,
bool  rowMajor = true 
)
inline

Initialize from array with dimensions (rows x cols). If the array is in row-major format set rowMajor to true, otherwise set to false for column-major.

template<class Real , int Options>
honey::Matrix< 4, 4, Real, Options >::Matrix ( const Quat q)
inline

Construct from quaternion.

template<class Real , int Options>
honey::Matrix< 4, 4, Real, Options >::Matrix ( const Transform tm)
inline

Initialize from transform.

template<class Real , int Options>
template<class T >
honey::Matrix< 4, 4, Real, Options >::Matrix ( const MatrixBase< T > &  rhs)
inline

Construct from matrix of same size.

Member Function Documentation

template<class Real , int Options>
Matrix honey::Matrix< 4, 4, Real, Options >::adjugate ( ) const

The adjugate matrix is the transpose of the cofactor matrix (used in inversion)

template<class Real , int Options>
void honey::Matrix< 4, 4, Real, Options >::decompose ( optional< Vec3 & >  trans = optnull,
optional< Quat & >  rot = optnull,
optional< Vec3 & >  scale = optnull,
optional< Quat & >  skew = optnull 
) const

Decompose matrix into translation, rotation, scale and skew.

Warning: If skew is requested and matrix likely has skew, then decomposition is about 10 times slower! Any matrix that has a non-uniform scale likely has skew. /see fromTrs()

template<class Real , int Options>
Real honey::Matrix< 4, 4, Real, Options >::determinant ( ) const

Get the determinant.

template<class Real , int Options>
template<class Num >
Matrix& honey::Matrix< 4, 4, Real, Options >::fromColMajor ( const Num *  a)
inlineprotected
template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::fromIdentity ( )
inline

Make matrix identity.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::fromLookAt ( const Vec3 eye,
const Vec3 at,
const Vec3 up 
)

Construct a matrix suitable for a camera.

The result is a right-handed orthonormal space at eye that points towards at along its +Z axis. up is the world's up axis (usually the +Y axis).

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::fromObliqueProjection ( const Vec3 normal,
const Vec3 point,
const Vec3 dir 
)

Construct a matrix that represents a projection onto a plane along a direction.

normal and point define the plane. dir is the unit length projection direction.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::fromPerspectiveProjection ( const Vec3 normal,
const Vec3 point,
const Vec3 eye 
)

Construct a matrix that represents a perspective projection onto a plane.

normal and point define the plane. eye is the eye point.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::fromReflection ( const Vec3 normal,
const Vec3 point 
)

Construct a matrix that represents a reflection on a plane.

normal and point define the plane.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::fromScalar ( Real  f)
inline

Initialize with scalar in every element.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::fromTm ( const Transform tm)

Initialize from transform.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::fromTrs ( const Vec3 trans,
const Quat rot = Quat::identity,
const Vec3 scale = Vec3::one,
const Quat skew = Quat::identity 
)
inline

Init from translation, rotation, scale and skew.

A transform first scales, then rotates, then translates: $ tm = T R S $

Scaling is done by first rotating into scale-space using the inverse of skew, then scaling, then rotating back out of scale-space: $ S = U K U^{-1} $

template<class Real , int Options>
Quat honey::Matrix< 4, 4, Real, Options >::getRot ( ) const
inline

Get rotation. Beware: bogus if mat contains scale/skew.

template<class Real , int Options>
Vec3 honey::Matrix< 4, 4, Real, Options >::getScale ( ) const
inline

Get scale. Beware: bogus if mat contains rot/skew.

template<class Real , int Options>
Vec3 honey::Matrix< 4, 4, Real, Options >::getTrans ( ) const
inline

Get translation.

template<class Real , int Options>
Matrix honey::Matrix< 4, 4, Real, Options >::inverse ( optional< Real & >  det = optnull) const

Get the inverse of this matrix. The determinant will be returned in det if specified.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::mul ( const Matrix< 4, 4, Real, Options > &  rhs,
Matrix< 4, 4, Real, Options > &  res 
) const
inline
template<class Real , int Options>
Matrix&& honey::Matrix< 4, 4, Real, Options >::mul ( const Matrix< 4, 4, Real, Options > &  rhs,
Matrix< 4, 4, Real, Options > &&  res 
) const
inline
template<class Real , int Options>
Vec3 honey::Matrix< 4, 4, Real, Options >::mulAffine ( const Vec3 v) const
inline

Transform vector with affine part of matrix (apply pos/rot/scale). Same as operator*() but without projection back into w = 1.

template<class Real , int Options>
Vec3 honey::Matrix< 4, 4, Real, Options >::mulRotScale ( const Vec3 v) const
inline

Transform vector with upper-left 3x3 rot/scale sub-matrix (no translation)

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::mulTranspose ( const Matrix< 4, 4, Real, Options > &  rhs,
Matrix< 4, 4, Real, Options > &  res 
) const
inline
template<class Real , int Options>
Matrix&& honey::Matrix< 4, 4, Real, Options >::mulTranspose ( const Matrix< 4, 4, Real, Options > &  rhs,
Matrix< 4, 4, Real, Options > &&  res 
) const
inline
template<class Real , int Options>
template<class T >
Matrix<s_rows, T::s_cols, Real> honey::Matrix< 4, 4, Real, Options >::operator* ( const T &  rhs) const
inline

Forward to base.

template<class Real , int Options>
Matrix honey::Matrix< 4, 4, Real, Options >::operator* ( Real  rhs) const
inline
template<class Real , int Options>
VecCol honey::Matrix< 4, 4, Real, Options >::operator* ( const VecCol v) const
inline

Square matrix, so multiplying a column vector on the right returns a column vector of the same dimension.

template<class Real , int Options>
Vec3 honey::Matrix< 4, 4, Real, Options >::operator* ( const Vec3 v) const
inline

Assumes vector has w = 1, transforms and projects result back into w = 1.

template<class Real , int Options>
Vec2 honey::Matrix< 4, 4, Real, Options >::operator* ( const Vec2 v) const
inline

Assumes vector has (z,w) = (0,1), transforms and projects result back into w = 1.

template<class Real , int Options>
template<class T >
Matrix& honey::Matrix< 4, 4, Real, Options >::operator= ( const MatrixBase< T > &  rhs)
inline

Assign to matrix of same size.

template<class Real , int Options>
void honey::Matrix< 4, 4, Real, Options >::orthonormalize ( )

Gram-Schmidt orthonormalization on upper-left 3x3 submatrix. Useful for re-normalizing an orthonormal basis to eliminate rounding errors.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::preRotate ( const Quat q)
inline

Make a tm that does a rotation first, then performs this transform. ie. This * R.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::preScale ( const Vec3 v,
const Quat skew = Quat::identity 
)
inline

Make a tm that does a scale first, then performs this transform. ie. This * S.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::preScale ( Real  f)
inline

Uniform prescale.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::preTranslate ( const Vec3 v)
inline

Make a tm that does a translation first, then performs this transform. ie. This * T.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::rotate ( const Quat q)
inline

Make a tm that performs this transform first, then does a rotation. ie. R * This.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::scale ( const Vec3 v,
const Quat skew = Quat::identity 
)
inline

Make a tm that performs this transform first, then does a scale. ie. S * This.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::scale ( Real  f)
inline

Uniform scale.

template<class Real , int Options>
void honey::Matrix< 4, 4, Real, Options >::setRot ( const Quat q)
inline

Set rotation. Beware: overwrites scale/skew.

template<class Real , int Options>
void honey::Matrix< 4, 4, Real, Options >::setScale ( const Vec3 v,
const Quat skew = Quat::identity 
)
inline

Set scale. Beware: overwrites rotation.

template<class Real , int Options>
void honey::Matrix< 4, 4, Real, Options >::setScale ( Real  f)
inline

Set uniform scale. Beware: overwrites rotation.

template<class Real , int Options>
void honey::Matrix< 4, 4, Real, Options >::setTrans ( const Vec3 v)
inline

Set translation.

template<class Real , int Options>
template<class Num >
Num* honey::Matrix< 4, 4, Real, Options >::toColMajor ( Num *  a) const
inlineprotected
template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::translate ( const Vec3 v)
inline

Make a tm that performs this transform first, then does a translation. ie. T * This.

template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::transpose ( Matrix< 4, 4, Real, Options > &  res) const
inline
template<class Real , int Options>
Matrix&& honey::Matrix< 4, 4, Real, Options >::transpose ( Matrix< 4, 4, Real, Options > &&  res) const
inline
template<class Real , int Options>
void honey::Matrix< 4, 4, Real, Options >::transposeInPlace ( )
inline
template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::transposeMul ( const Matrix< 4, 4, Real, Options > &  rhs,
Matrix< 4, 4, Real, Options > &  res 
) const
inline
template<class Real , int Options>
Matrix&& honey::Matrix< 4, 4, Real, Options >::transposeMul ( const Matrix< 4, 4, Real, Options > &  rhs,
Matrix< 4, 4, Real, Options > &&  res 
) const
inline
template<class Real , int Options>
Matrix& honey::Matrix< 4, 4, Real, Options >::transposeMulTranspose ( const Matrix< 4, 4, Real, Options > &  rhs,
Matrix< 4, 4, Real, Options > &  res 
) const
inline
template<class Real , int Options>
Matrix&& honey::Matrix< 4, 4, Real, Options >::transposeMulTranspose ( const Matrix< 4, 4, Real, Options > &  rhs,
Matrix< 4, 4, Real, Options > &&  res 
) const
inline

Friends And Related Function Documentation

template<class Real , int Options>
template<class T >
friend class MatrixBase
friend
template<class Real , int Options>
VecRow operator* ( const VecRow v,
const Matrix< 4, 4, Real, Options > &  mat 
)
friend

Square matrix, so multiplying a row vector on the left returns a row vector of the same dimension.

Member Data Documentation

template<class Real , int Options>
const Matrix honey::Matrix< 4, 4, Real, Options >::identity
static
template<class Real , int Options>
const Matrix honey::Matrix< 4, 4, Real, Options >::zero
static

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