Atoms Crowd  7.0.0
Matrix22< T > Class Template Reference

#include <ImathMatrix.h>

Public Types

typedef T BaseType
 
typedef Vec2< 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 Matrix22 (const Matrix22< S > &v) noexcept
 
template<class S >
void getValue (Matrix22< S > &v) const noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 Matrix22< T > & setValue (const Matrix22< S > &v) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 Matrix22< T > & setTheMatrix (const Matrix22< S > &v) noexcept
 
template<class S >
void multDirMatrix (const Vec2< S > &src, Vec2< S > &dst) const noexcept
 
template<class S >
const Matrix22< T > & setRotation (S r) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix22< T > & rotate (S r) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix22< T > & setScale (const Vec2< S > &s) noexcept
 
template<class S >
ATOMSMATH_CONSTEXPR14 const Matrix22< T > & scale (const Vec2< S > &s) noexcept
 
Constructors and Assignment
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22 () noexcept
 Uninitialized. More...
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22 (T a) noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22 (const T a[2][2]) noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22 (T a, T b, T c, T d) noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22 (const Matrix22 &v) noexcept
 Copy constructor.
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22 (const Matrix22< S > &v) noexcept
 Construct from Matrix22 of another base type.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator= (const Matrix22 &v) noexcept
 Assignment.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator= (T a) noexcept
 Assignment from scalar.
 
 ~Matrix22 () 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 (Matrix22< S > &v) const noexcept
 Return the value in v
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22setValue (const Matrix22< S > &v) noexcept
 Set the value.
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22setTheMatrix (const Matrix22< S > &v) noexcept
 Set the value.
 
Arithmetic and Comparison
constexpr ATOMSMATH_HOSTDEVICE bool operator== (const Matrix22 &v) const noexcept
 Equality.
 
constexpr ATOMSMATH_HOSTDEVICE bool operator!= (const Matrix22 &v) const noexcept
 Inequality.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool equalWithAbsError (const Matrix22< T > &v, T e) const noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool equalWithRelError (const Matrix22< T > &v, T e) const noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator+= (const Matrix22 &v) noexcept
 Component-wise addition.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator+= (T a) noexcept
 Component-wise addition.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix22 operator+ (const Matrix22 &v) const noexcept
 Component-wise addition.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator-= (const Matrix22 &v) noexcept
 Component-wise subtraction.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator-= (T a) noexcept
 Component-wise subtraction.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix22 operator- (const Matrix22 &v) const noexcept
 Component-wise subtraction.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix22 operator- () const noexcept
 Component-wise multiplication by -1.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22negate () noexcept
 Component-wise multiplication by -1.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator*= (T a) noexcept
 Component-wise multiplication.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix22 operator* (T a) const noexcept
 Component-wise multiplication.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator/= (T a) noexcept
 Component-wise division.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix22 operator/ (T a) const noexcept
 Component-wise division.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22operator*= (const Matrix22 &v) noexcept
 Matrix-matrix multiplication.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22 operator* (const Matrix22 &v) const noexcept
 Matrix-matrix multiplication.
 
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.
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22transpose () noexcept
 Transpose.
 
constexpr ATOMSMATH_HOSTDEVICE Matrix22 transposed () const noexcept
 Return the transpose.
 
ATOMSMATH_CONSTEXPR14 const Matrix22invert (bool singExc)
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22invert () noexcept
 
ATOMSMATH_CONSTEXPR14 Matrix22< T > inverse (bool singExc) const
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Matrix22< T > inverse () const noexcept
 Return the inverse, leaving this unmodified.
 
constexpr ATOMSMATH_HOSTDEVICE T determinant () const noexcept
 Determinant.
 
template<class S >
ATOMSMATH_HOSTDEVICE const Matrix22setRotation (S r) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22rotate (S r) noexcept
 
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22setScale (T s) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22setScale (const Vec2< S > &s) noexcept
 
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22scale (const Vec2< S > &s) noexcept
 

Static Public Member Functions

constexpr static ATOMSMATH_HOSTDEVICE unsigned int dimensions () noexcept
 Return the number of the row and column dimensions, i.e. 2.
 
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 [2][2]
 Matrix elements.
 

Detailed Description

template<class T>
class Matrix22< T >

2x2 transformation matrix

Member Typedef Documentation

◆ BaseType

template<class T >
typedef T Matrix22< T >::BaseType

The base type: In templates that accept a parameter V, you can refer to T as V::BaseType

Constructor & Destructor Documentation

◆ Matrix22() [1/4]

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

Uninitialized.

Default constructor: initialize to identity

1 0 0 1

◆ Matrix22() [2/4]

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

Initialize to scalar constant:

a a a a

◆ Matrix22() [3/4]

template<class T >
ATOMSMATH_CONSTEXPR14 Matrix22< T >::Matrix22 ( const T  a[2][2])
inlinenoexcept

Construct from 2x2 array:

a[0][0] a[0][1] a[1][0] a[1][1]

◆ Matrix22() [4/4]

template<class T >
ATOMSMATH_CONSTEXPR14 Matrix22< T >::Matrix22 ( a,
b,
c,
d 
)
inlinenoexcept

Construct from given scalar values:

a b c d

Member Function Documentation

◆ equalWithAbsError()

template<class T >
ATOMSMATH_CONSTEXPR14 bool Matrix22< T >::equalWithAbsError ( const Matrix22< 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 Matrix22< T >::equalWithRelError ( const Matrix22< 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])

◆ inverse()

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

Return the inverse, leaving this unmodified.

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

◆ invert() [1/2]

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

Invert in place

Returns
const reference to this

◆ invert() [2/2]

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

Invert in place

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 Matrix22< T >::multDirMatrix ( const Vec2< S > &  src,
Vec2< S > &  dst 
) const
noexcept

Vector * matrix multiplication

Parameters
[in]srcInput vector
[out]dsttransformed vector

◆ rotate()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22& Matrix22< T >::rotate ( r)
noexcept

Rotate the given matrix by r (in radians)

Returns
const referenced to this

◆ scale()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Matrix22& Matrix22< T >::scale ( const Vec2< S > &  s)
noexcept
Returns
const referenced to this

◆ setRotation()

template<class T >
template<class S >
ATOMSMATH_HOSTDEVICE const Matrix22& Matrix22< 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 Matrix22& Matrix22< 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 Matrix22< T > & Matrix22< T >::setScale ( s)
inlinenoexcept

Set matrix to scale by given uniform factor

Returns
const referenced to this

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