Atoms Crowd  7.0.0
Matrix33< T > Class Template Reference

#include <ImathMatrix.h>

Public Types

typedef T BaseType
 The base type: In templates that accept a parameter V (could be a Color4), you can refer to T as V::BaseType
 
typedef Vec3< T > BaseVecType
 The base vector type.
 

Public Member Functions

ATOMSMATH_HOSTDEVICE T * operator[] (int i) noexcept
 Row access.
 
ATOMSMATH_HOSTDEVICE const T * operator[] (int i) const noexcept
 Row access.
 
template<class S >
ATOMSMATH_CONSTEXPR14 Matrix33 (const Matrix33< S > &v) noexcept
 
template<class S >
void getValue (Matrix33< S > &v) const noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 Matrix33< T > & setValue (const Matrix33< S > &v) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 Matrix33< T > & setTheMatrix (const Matrix33< S > &v) noexcept
 
template<class S >
void multVecMatrix (const Vec2< S > &src, Vec2< S > &dst) const noexcept
 
template<class S >
void multDirMatrix (const Vec2< S > &src, Vec2< S > &dst) const noexcept
 
template<class S >
const Matrix33< T > & setRotation (S r) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & rotate (S r) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & setScale (const Vec2< S > &s) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & scale (const Vec2< S > &s) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & setTranslation (const Vec2< S > &t) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & translate (const Vec2< S > &t) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & setShear (const S &xy) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & setShear (const Vec2< S > &h) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & shear (const S &xy) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & shear (const Vec2< S > &h) noexcept
 
Constructors and Assignment
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33 () noexcept
 Uninitialized. More...
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33 (T a) noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33 (const T a[3][3]) noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33 (T a, T b, T c, T d, T e, T f, T g, T h, T i) noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33 (const Matrix33 &v) noexcept
 Copy constructor.
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33 (const Matrix33< S > &v) noexcept
 Construct from Matrix33 of another base type.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator= (const Matrix33 &v) noexcept
 Assignment operator.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator= (T a) noexcept
 Assignment from scalar.
 
 ~Matrix33 () noexcept=default
 Destructor.
 
Compatibility with Sb
ATOMSMATH_HOSTDEVICE T * getValue () noexcept
 Return a raw pointer to the array of values.
 
ATOMSMATH_HOSTDEVICE const T * getValue () const noexcept
 Return a raw pointer to the array of values.
 
template<class S >
ATOMSMATH_HOSTDEVICE void getValue (Matrix33< S > &v) const noexcept
 Return the value in v
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33setValue (const Matrix33< S > &v) noexcept
 Set the value.
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33setTheMatrix (const Matrix33< S > &v) noexcept
 Set the value.
 
Arithmetic and Comparison
constexpr ATOMSMATH_HOSTDEVICE bool operator== (const Matrix33 &v) const noexcept
 Equality.
 
constexpr ATOMSMATH_HOSTDEVICE bool operator!= (const Matrix33 &v) const noexcept
 Inequality.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool equalWithAbsError (const Matrix33< T > &v, T e) const noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool equalWithRelError (const Matrix33< T > &v, T e) const noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator+= (const Matrix33 &v) noexcept
 Component-wise addition.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator+= (T a) noexcept
 Component-wise addition.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix33 operator+ (const Matrix33 &v) const noexcept
 Component-wise addition.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator-= (const Matrix33 &v) noexcept
 Component-wise subtraction.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator-= (T a) noexcept
 Component-wise subtraction.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix33 operator- (const Matrix33 &v) const noexcept
 Component-wise subtraction.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix33 operator- () const noexcept
 Component-wise multiplication by -1.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33negate () noexcept
 Component-wise multiplication by -1.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator*= (T a) noexcept
 Component-wise multiplication.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix33 operator* (T a) const noexcept
 Component-wise multiplication.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator/= (T a) noexcept
 Component-wise division.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix33 operator/ (T a) const noexcept
 Component-wise division.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33operator*= (const Matrix33 &v) noexcept
 Matrix-matrix multiplication.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33 operator* (const Matrix33 &v) const noexcept
 Matrix-matrix multiplication.
 
template<class S >
ATOMSMATH_HOSTDEVICE void multVecMatrix (const Vec2< S > &src, Vec2< S > &dst) const noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE void multDirMatrix (const Vec2< S > &src, Vec2< S > &dst) const noexcept
 
Maniplation
ATOMSMATH_HOSTDEVICE void makeIdentity () noexcept
 Set to the identity matrix.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33transpose () noexcept
 Transpose.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix33 transposed () const noexcept
 Return the transpose.
 
ATOMSMATH_CONSTEXPR14 const Matrix33invert (bool singExc)
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33invert () noexcept
 
ATOMSMATH_CONSTEXPR14 Matrix33< T > inverse (bool singExc) const
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix33< T > inverse () const noexcept
 Return the inverse using the determinant, leaving this unmodified.
 
const Matrix33gjInvert (bool singExc)
 
ATOMSMATH_HOSTDEVICE const Matrix33gjInvert () noexcept
 
Matrix33< T > gjInverse (bool singExc) const
 
ATOMSMATH_HOSTDEVICE Matrix33< T > gjInverse () const noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 T minorOf (const int r, const int c) const noexcept
 Calculate the matrix minor of the (r,c) element.
 
constexpr ATOMSMATH_HOSTDEVICE T fastMinor (const int r0, const int r1, const int c0, const int c1) const noexcept
 Build a minor using the specified rows and columns.
 
constexpr ATOMSMATH_HOSTDEVICE T determinant () const noexcept
 Determinant.
 
template<class S >
ATOMSMATH_HOSTDEVICE const Matrix33setRotation (S r) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33rotate (S r) noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33setScale (T s) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33setScale (const Vec2< S > &s) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33scale (const Vec2< S > &s) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33setTranslation (const Vec2< S > &t) noexcept
 
constexpr ATOMSMATH_HOSTDEVICE Vec2< T > translation () const noexcept
 Return the translation component.
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33translate (const Vec2< S > &t) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33setShear (const S &h) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33setShear (const Vec2< S > &h) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33shear (const S &xy) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33shear (const Vec2< S > &h) noexcept
 

Static Public Member Functions

constexpr static ATOMSMATH_HOSTDEVICE unsigned int dimensions () noexcept
 Return the number of the row and column dimensions, i.e. 3.
 
Numeric Limits
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeLowest () noexcept
 Largest possible negative value.
 
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeMax () noexcept
 Largest possible positive value.
 
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeSmallest () noexcept
 Smallest possible positive value.
 
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeEpsilon () noexcept
 Smallest possible e for which 1+e != 1.
 

Public Attributes

Direct access to elements
x [3][3]
 Matrix elements.
 

Detailed Description

template<class T>
class Matrix33< T >

3x3 transformation matrix

Constructor & Destructor Documentation

◆ Matrix33() [1/4]

template<class T >
ATOMSMATH_CONSTEXPR14 Matrix33< T >::Matrix33
inlinenoexcept

Uninitialized.

Default constructor: initialize to identity 1 0 0 0 1 0 0 0 1

◆ Matrix33() [2/4]

template<class T >
ATOMSMATH_CONSTEXPR14 Matrix33< T >::Matrix33 ( a)
inlinenoexcept

Initialize to scalar constant a a a a a a a a a

◆ Matrix33() [3/4]

template<class T >
ATOMSMATH_CONSTEXPR14 Matrix33< T >::Matrix33 ( const T  a[3][3])
inlinenoexcept

Construct from 3x3 array a[0][0] a[0][1] a[0][2] a[1][0] a[1][1] a[1][2] a[2][0] a[2][1] a[2][2]

◆ Matrix33() [4/4]

template<class T >
ATOMSMATH_CONSTEXPR14 Matrix33< T >::Matrix33 ( a,
b,
c,
d,
e,
f,
g,
h,
i 
)
inlinenoexcept

Construct from given scalar values a b c d e f g h i

Member Function Documentation

◆ equalWithAbsError()

template<class T >
ATOMSMATH_CONSTEXPR14 bool Matrix33< T >::equalWithAbsError ( const Matrix33< T > &  v,
e 
) const
inlinenoexcept

Compare two matrices and test if they are "approximately equal":

Returns
True if the coefficients of this and m are the same with an absolute error of no more than e, i.e., for all i, j:

abs (this[i][j] - m[i][j]) <= e

◆ equalWithRelError()

template<class T >
ATOMSMATH_CONSTEXPR14 bool Matrix33< T >::equalWithRelError ( const Matrix33< T > &  v,
e 
) const
inlinenoexcept

Compare two matrices and test if they are "approximately equal":

Returns
True if the coefficients of this and m are the same with a relative error of no more than e, i.e., for all i, j:

abs (this[i] - v[i][j]) <= e * abs (this[i][j])

◆ gjInverse() [1/2]

template<class T >
Matrix33< T > Matrix33< T >::gjInverse
inlinenoexcept

Return the inverse using the Gauss-Jordan method. Significantly slower, leaving this unmodified. Slower but more accurate than inverse().

◆ gjInverse() [2/2]

template<class T >
Matrix33< T > Matrix33< T >::gjInverse ( bool  singExc) const
inline

Return the inverse using the Gauss-Jordan method, leaving this unmodified. Significantly slower but more accurate than inverse().

◆ gjInvert() [1/2]

template<class T >
const Matrix33< T > & Matrix33< T >::gjInvert
inlinenoexcept

Invert in place using the Gauss-Jordan method. Significantly slower but more accurate than invert().

Returns
const reference to this

◆ gjInvert() [2/2]

template<class T >
const Matrix33< T > & Matrix33< T >::gjInvert ( bool  singExc)
inline

Invert in place using the Gauss-Jordan method. Significantly slower but more accurate than invert().

Parameters
singExcIf true, throw an exception if the matrix cannot be inverted.
Returns
const reference to this

◆ inverse()

template<class T >
ATOMSMATH_CONSTEXPR14 Matrix33< T > Matrix33< T >::inverse ( bool  singExc) const
inline

Return the inverse using the determinant, leaving this unmodified.

Parameters
singExcIf true, throw an exception if the matrix cannot be inverted.

◆ invert() [1/2]

template<class T >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & Matrix33< T >::invert
inlinenoexcept

Invert in place using the determinant.

Returns
const reference to this

◆ invert() [2/2]

template<class T >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & Matrix33< T >::invert ( bool  singExc)
inline

Invert in place using the determinant.

Parameters
singExcIf true, throw an exception if the matrix cannot be inverted.
Returns
const reference to this

◆ multDirMatrix()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE void Matrix33< T >::multDirMatrix ( const Vec2< S > &  src,
Vec2< S > &  dst 
) const
noexcept

Vector-matrix multiplication: multiply src by the upper left 2x2 submatrix, ignoring the rest of matrix.

Parameters
[in]srcThe input vector
[out]dstThe output vector

◆ multVecMatrix()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE void Matrix33< T >::multVecMatrix ( const Vec2< S > &  src,
Vec2< S > &  dst 
) const
noexcept

Vector-matrix multiplication: a homogeneous transformation by computing Vec3 (src.x, src.y, 1) * m and dividing by the result's third element.

Parameters
[in]srcThe input vector
[out]dstThe output vector

◆ rotate()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::rotate ( r)
noexcept
Returns
const referenced to this

◆ scale()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::scale ( const Vec2< S > &  s)
noexcept

Scale the matrix by s

Returns
const referenced to this

◆ setRotation()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE const Matrix33& Matrix33< T >::setRotation ( r)
noexcept

Set matrix to rotation by r (in radians)

Returns
const referenced to this

◆ setScale() [1/2]

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::setScale ( const Vec2< S > &  s)
noexcept

Set matrix to scale by given vector

Returns
const referenced to this

◆ setScale() [2/2]

template<class T >
ATOMSMATH_CONSTEXPR14 const Matrix33< T > & Matrix33< T >::setScale ( s)
inlinenoexcept

Set matrix to scale by given uniform factor

Returns
const referenced to this

◆ setShear() [1/2]

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::setShear ( const S &  h)
noexcept

Set matrix to shear x for each y coord. by given factor xy

Returns
const referenced to this

◆ setShear() [2/2]

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::setShear ( const Vec2< S > &  h)
noexcept

Set matrix to shear x for each y coord. by given factor h[0] and to shear y for each x coord. by given factor h[1]

Returns
const referenced to this

◆ setTranslation()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::setTranslation ( const Vec2< S > &  t)
noexcept

Set matrix to translation by given vector

Returns
const referenced to this

◆ shear() [1/2]

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::shear ( const S &  xy)
noexcept

Shear the matrix in x for each y coord. by given factor xy

Returns
const referenced to this

◆ shear() [2/2]

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::shear ( const Vec2< S > &  h)
noexcept

Shear the matrix in x for each y coord. by given factor xy and shear y for each x coord. by given factor yx

Returns
const referenced to this

◆ translate()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix33& Matrix33< T >::translate ( const Vec2< S > &  t)
noexcept

Translate the matrix by t

Returns
const referenced to this

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