Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::math::TMatrix2< T > Class Template Referencefinal

Represents a 2x2 matrix. More...

#include <TMatrix2.h>

Public Types

using Elements = std::array<std::array<T, 2>, 2>
 

Public Member Functions

 TMatrix2 ()=default
 
 TMatrix2 (T value)
 
 TMatrix2 (T m00, T m01, T m10, T m11)
 
 TMatrix2 (const TVector2< T > &m00m01, const TVector2< T > &m10m11)
 
 TMatrix2 (const TMatrix2 &other)=default
 
template<typename U >
 TMatrix2 (const TMatrix2< U > &other)
 
TMatrix2initIdentity ()
 
TMatrix2 mul (const TMatrix2 &rhs) const
 
TMatrix2 mul (T value) const
 
void mul (const TMatrix2 &rhs, TMatrix2 *out_result) const
 
TMatrix2mulLocal (T value)
 
TMatrix2 inverse () const
 
determinant () const
 
bool solve (const std::array< T, 2 > &b, std::array< T, 2 > *out_x) const
 Solves linear systems of the form Ax = b.
 
bool solve (const TVector2< T > &b, TVector2< T > *out_x) const
 Solves linear systems of the form Ax = b.
 
template<std::size_t N>
bool solve (const std::array< std::array< T, 2 >, N > &bs, std::array< std::array< T, 2 >, N > *out_xs) const
 Solve N linear systems of the form Ax = b.
 
std::string toString () const
 

Static Public Member Functions

static TMatrix2 makeIdentity ()
 

Public Attributes

Elements m
 

Detailed Description

template<typename T>
class ph::math::TMatrix2< T >

Represents a 2x2 matrix.

Member Typedef Documentation

◆ Elements

template<typename T >
using ph::math::TMatrix2< T >::Elements = std::array<std::array<T, 2>, 2>

Constructor & Destructor Documentation

◆ TMatrix2() [1/6]

template<typename T >
ph::math::TMatrix2< T >::TMatrix2 ( )
inlinedefault

◆ TMatrix2() [2/6]

template<typename T >
ph::math::TMatrix2< T >::TMatrix2 ( T value)
inlineexplicit

◆ TMatrix2() [3/6]

template<typename T >
ph::math::TMatrix2< T >::TMatrix2 ( T m00,
T m01,
T m10,
T m11 )
inline

◆ TMatrix2() [4/6]

template<typename T >
ph::math::TMatrix2< T >::TMatrix2 ( const TVector2< T > & m00m01,
const TVector2< T > & m10m11 )
inline

◆ TMatrix2() [5/6]

template<typename T >
ph::math::TMatrix2< T >::TMatrix2 ( const TMatrix2< T > & other)
inlinedefault

◆ TMatrix2() [6/6]

template<typename T >
template<typename U >
ph::math::TMatrix2< T >::TMatrix2 ( const TMatrix2< U > & other)
inlineexplicit

Member Function Documentation

◆ determinant()

template<typename T >
T ph::math::TMatrix2< T >::determinant ( ) const
inline

◆ initIdentity()

template<typename T >
TMatrix2< T > & ph::math::TMatrix2< T >::initIdentity ( )
inline

◆ inverse()

template<typename T >
TMatrix2< T > ph::math::TMatrix2< T >::inverse ( ) const
inline

◆ makeIdentity()

template<typename T >
TMatrix2< T > ph::math::TMatrix2< T >::makeIdentity ( )
inlinestatic

◆ mul() [1/3]

template<typename T >
TMatrix2< T > ph::math::TMatrix2< T >::mul ( const TMatrix2< T > & rhs) const
inline

◆ mul() [2/3]

template<typename T >
void ph::math::TMatrix2< T >::mul ( const TMatrix2< T > & rhs,
TMatrix2< T > * out_result ) const
inline

◆ mul() [3/3]

template<typename T >
TMatrix2< T > ph::math::TMatrix2< T >::mul ( T value) const
inline

◆ mulLocal()

template<typename T >
TMatrix2< T > & ph::math::TMatrix2< T >::mulLocal ( T value)
inline

◆ solve() [1/3]

template<typename T >
template<std::size_t N>
bool ph::math::TMatrix2< T >::solve ( const std::array< std::array< T, 2 >, N > & bs,
std::array< std::array< T, 2 >, N > * out_xs ) const
inline

Solve N linear systems of the form Ax = b.

Treating this matrix as A, linear systems A*x_i = b_i (0 <= i < N) are solved. This is equivalent to having bs as a 2 by N matrix and passing them in column-major (out_xs follows similarly, except it's for outputs).

Parameters
AA 2x2 matrix.
bsN 2x1 vectors (or a 2xN matrix in column-major).
[out]out_xsN 2x1 vectors (or a 2xN matrix in column-major).
Returns
If x is successfully solved, method returns true and out_xs stores the answer; otherwise, false is returned and what out_xs stores is undefined.

◆ solve() [2/3]

template<typename T >
bool ph::math::TMatrix2< T >::solve ( const std::array< T, 2 > & b,
std::array< T, 2 > * out_x ) const
inline

Solves linear systems of the form Ax = b.

Treating this matrix as A.

Parameters
bA 2x1 vector.
[out]out_xA 2x1 vector.
Returns
If x is successfully solved, method returns true and out_x stores the answer; otherwise, false is returned and what out_x stores is undefined.

◆ solve() [3/3]

template<typename T >
bool ph::math::TMatrix2< T >::solve ( const TVector2< T > & b,
TVector2< T > * out_x ) const
inline

Solves linear systems of the form Ax = b.

See solve(const std::array<T, 2>&, std::array<T, 2>*) for details.

◆ toString()

template<typename T >
std::string ph::math::TMatrix2< T >::toString ( ) const
inline

Member Data Documentation

◆ m

template<typename T >
Elements ph::math::TMatrix2< T >::m

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