[nnm] No Nonsense Math 0.5.0
A No-Nonsense, C++ 17, single-header-only Math library geared towards graphics programming.
Loading...
Searching...
No Matches
nnm::Matrix3< Real > Class Template Reference

#include <nnm.hpp>

Public Member Functions

constexpr Matrix3 ()
template<typename Other>
constexpr Matrix3 (const Matrix3< Other > &matrix)
constexpr Matrix3 (const Vector3< Real > &column0, const Vector3< Real > &column1, const Vector3< Real > &column2)
constexpr Matrix3 (const Real col0_row0, const Real col0_row1, const Real col0_row2, const Real col1_row0, const Real col1_row1, const Real col1_row2, const Real col2_row0, const Real col2_row1, const Real col2_row2)
constexpr Real trace () const
constexpr Real determinant () const
constexpr Matrix2< Real > minor_matrix_at (const uint8_t column, const uint8_t row) const
constexpr Real minor_at (const uint8_t column, const uint8_t row) const
constexpr Matrix3 minor () const
constexpr Real cofactor_at (const uint8_t column, const uint8_t row) const
constexpr Matrix3 cofactor () const
constexpr Matrix3 transpose () const
constexpr Matrix3 adjugate () const
constexpr Matrix3 unchecked_inverse () const
constexpr std::optional< Matrix3inverse () const
constexpr bool approx_equal (const Matrix3 &other) const
constexpr bool approx_zero () const
constexpr const Vector3< Real > & at (const uint8_t column) const
constexpr Vector3< Real > & at (const uint8_t column)
constexpr const Real & at (const uint8_t column, const uint8_t row) const
constexpr Real & at (const uint8_t column, const uint8_t row)
const Real * begin () const
const Real * end () const
Real * begin ()
Real * end ()
constexpr const Vector3< Real > & operator[] (const uint8_t column) const
constexpr Vector3< Real > & operator[] (const uint8_t column)
constexpr bool operator== (const Matrix3 &other) const
constexpr bool operator!= (const Matrix3 &other) const
constexpr Matrix3 operator+ (const Matrix3 &other) const
constexpr Matrix3operator+= (const Matrix3 &other)
constexpr Matrix3 operator- (const Matrix3 &other) const
constexpr Matrix3operator-= (const Matrix3 &other)
constexpr Matrix3 operator* (const Matrix3 &other) const
constexpr Matrix3operator*= (const Matrix3 &other)
constexpr Vector3< Real > operator* (const Vector3< Real > &vector) const
constexpr Matrix3 operator* (const Real value) const
constexpr Matrix3operator*= (const Real value)
constexpr Matrix3 operator/ (const Real value) const
constexpr Matrix3operator/= (const Real value)
constexpr bool operator< (const Matrix3 &other) const
constexpr operator bool () const

Static Public Member Functions

static constexpr Matrix3 all (const Real value)
static constexpr Matrix3 zero ()
static constexpr Matrix3 one ()
static constexpr Matrix3 identity ()

Public Attributes

Vector3< Real > columns [3]

Detailed Description

template<typename Real>
class nnm::Matrix3< Real >

3x3 matrix.

Template Parameters
RealFloating-point type.

Constructor & Destructor Documentation

◆ Matrix3() [1/4]

template<typename Real>
nnm::Matrix3< Real >::Matrix3 ( )
inlineconstexpr

Initialize with identity matrix.

◆ Matrix3() [2/4]

template<typename Real>
template<typename Other>
nnm::Matrix3< Real >::Matrix3 ( const Matrix3< Other > & matrix)
inlineexplicitconstexpr

Case from other matrix type.

Template Parameters
OtherOther matrix type.
Parameters
matrixMatrix to cast from

◆ Matrix3() [3/4]

template<typename Real>
nnm::Matrix3< Real >::Matrix3 ( const Vector3< Real > & column0,
const Vector3< Real > & column1,
const Vector3< Real > & column2 )
inlineconstexpr

Initialize with columns.

Parameters
column0First column.
column1Second column.
column2Third column.

◆ Matrix3() [4/4]

template<typename Real>
nnm::Matrix3< Real >::Matrix3 ( const Real col0_row0,
const Real col0_row1,
const Real col0_row2,
const Real col1_row0,
const Real col1_row1,
const Real col1_row2,
const Real col2_row0,
const Real col2_row1,
const Real col2_row2 )
inlineconstexpr

Initialize with elements.

Parameters
col0_row0First column, first row
col0_row1First column, second row
col0_row2First column, third row
col1_row0Second column, first row
col1_row1Second column, second row
col1_row2Second column, third row
col2_row0Third column, first row
col2_row1Third column, second row
col2_row2Third column, third row

Member Function Documentation

◆ adjugate()

template<typename Real>
Matrix3 nnm::Matrix3< Real >::adjugate ( ) const
inlinenodiscardconstexpr

Adjugate matrix.

Returns
Result.

◆ all()

template<typename Real>
constexpr Matrix3 nnm::Matrix3< Real >::all ( const Real value)
inlinestaticnodiscardconstexpr

Matrix with all elements equal to value.

Parameters
valueValue.
Returns
Result.

◆ approx_equal()

template<typename Real>
bool nnm::Matrix3< Real >::approx_equal ( const Matrix3< Real > & other) const
inlinenodiscardconstexpr

Element-wise approximately equal.

Parameters
otherOther matrix.
Returns
True if approximately equal, false otherwise.

◆ approx_zero()

template<typename Real>
bool nnm::Matrix3< Real >::approx_zero ( ) const
inlinenodiscardconstexpr

If all elements are approximately zero.

Returns
True if approximately zero, false otherwise.

◆ at() [1/4]

template<typename Real>
Vector3< Real > & nnm::Matrix3< Real >::at ( const uint8_t column)
inlineconstexpr

Reference to column at index.

Parameters
columnColumn.
Returns
Reference.

◆ at() [2/4]

template<typename Real>
const Vector3< Real > & nnm::Matrix3< Real >::at ( const uint8_t column) const
inlinenodiscardconstexpr

Constant reference to column at index.

Parameters
columnColumn.
Returns
Constant reference.

◆ at() [3/4]

template<typename Real>
Real & nnm::Matrix3< Real >::at ( const uint8_t column,
const uint8_t row )
inlineconstexpr

Reference to element at column and row.

Parameters
columnColumn.
rowRow.
Returns
Reference.

◆ at() [4/4]

template<typename Real>
const Real & nnm::Matrix3< Real >::at ( const uint8_t column,
const uint8_t row ) const
inlinenodiscardconstexpr

Constant reference to element at column and row.

Parameters
columnColumn.
rowRow.
Returns
Constant reference.

◆ begin() [1/2]

template<typename Real>
Real * nnm::Matrix3< Real >::begin ( )
inline

Start iterator.

Returns
Iterator.

◆ begin() [2/2]

template<typename Real>
const Real * nnm::Matrix3< Real >::begin ( ) const
inlinenodiscard

Start constant iterator.

Returns
Constant iterator.

◆ cofactor()

template<typename Real>
Matrix3 nnm::Matrix3< Real >::cofactor ( ) const
inlinenodiscardconstexpr

Cofactor matrix.

Returns
Result.

◆ cofactor_at()

template<typename Real>
Real nnm::Matrix3< Real >::cofactor_at ( const uint8_t column,
const uint8_t row ) const
inlinenodiscardconstexpr

Cofactor at column and row.

Parameters
column
row
Returns
Result.

◆ determinant()

template<typename Real>
Real nnm::Matrix3< Real >::determinant ( ) const
inlinenodiscardconstexpr

Matrix determinant.

Returns
Result.

◆ end() [1/2]

template<typename Real>
Real * nnm::Matrix3< Real >::end ( )
inline

End iterator.

Returns
Iterator.

◆ end() [2/2]

template<typename Real>
const Real * nnm::Matrix3< Real >::end ( ) const
inlinenodiscard

End constant iterator.

Returns
Constant iterator.

◆ identity()

template<typename Real>
constexpr Matrix3 nnm::Matrix3< Real >::identity ( )
inlinestaticnodiscardconstexpr

Identity matrix.

Returns
Result.

◆ inverse()

template<typename Real>
std::optional< Matrix3 > nnm::Matrix3< Real >::inverse ( ) const
inlinenodiscardconstexpr

Inverse which returns null if there is no inverse.

Returns
Inverse if there is one, null if not.

◆ minor()

template<typename Real>
Matrix3 nnm::Matrix3< Real >::minor ( ) const
inlinenodiscardconstexpr

Minor matrix.

Returns
Result.

◆ minor_at()

template<typename Real>
Real nnm::Matrix3< Real >::minor_at ( const uint8_t column,
const uint8_t row ) const
inlinenodiscardconstexpr

Minor at column and row which is the determinant of the minor matrix at that column and row.

Parameters
columnColumn.
rowRow.
Returns
Result.

◆ minor_matrix_at()

template<typename Real>
Matrix2< Real > nnm::Matrix3< Real >::minor_matrix_at ( const uint8_t column,
const uint8_t row ) const
inlinenodiscardconstexpr

Minor matrix at column and row which is the resulting 2x2 matrix with that column and row excluded.

Parameters
columnColumn.
rowRow.
Returns
Resulting 2x2 matrix.

◆ one()

template<typename Real>
constexpr Matrix3 nnm::Matrix3< Real >::one ( )
inlinestaticnodiscardconstexpr

Matrix with all elements one.

Returns
Result.

◆ operator bool()

template<typename Real>
nnm::Matrix3< Real >::operator bool ( ) const
inlineexplicitconstexpr

Evaluates to false if all components are zero, true otherwise.

◆ operator!=()

template<typename Real>
bool nnm::Matrix3< Real >::operator!= ( const Matrix3< Real > & other) const
inlineconstexpr

Element-wise inequality.

Parameters
otherOther matrix.
Returns
True if not equal, false otherwise.

◆ operator*() [1/3]

template<typename Real>
Matrix3 nnm::Matrix3< Real >::operator* ( const Matrix3< Real > & other) const
inlinenodiscardconstexpr

Matrix multiplication.

Parameters
otherOther matrix.
Returns
Result.

◆ operator*() [2/3]

template<typename Real>
Matrix3 nnm::Matrix3< Real >::operator* ( const Real value) const
inlinenodiscardconstexpr

Element-wise multiplication with value.

Parameters
valueValue.
Returns
Result.

◆ operator*() [3/3]

template<typename Real>
Vector3< Real > nnm::Matrix3< Real >::operator* ( const Vector3< Real > & vector) const
inlinenodiscardconstexpr

Matrix-vector multiplication.

Parameters
vectorVector.
Returns
Resulting three-dimensional vector.

◆ operator*=() [1/2]

template<typename Real>
Matrix3 & nnm::Matrix3< Real >::operator*= ( const Matrix3< Real > & other)
inlineconstexpr

Matrix multiplication.

Parameters
otherOther matrix.
Returns
Reference to this modified matrix.

◆ operator*=() [2/2]

template<typename Real>
Matrix3 & nnm::Matrix3< Real >::operator*= ( const Real value)
inlineconstexpr

Element-wise multiplication with value.

Parameters
valueValue.
Returns
Reference to this modified matrix.

◆ operator+()

template<typename Real>
Matrix3 nnm::Matrix3< Real >::operator+ ( const Matrix3< Real > & other) const
inlinenodiscardconstexpr

Element-wise addition.

Parameters
otherOther matrix.
Returns
Result.

◆ operator+=()

template<typename Real>
Matrix3 & nnm::Matrix3< Real >::operator+= ( const Matrix3< Real > & other)
inlineconstexpr

Element-wise addition.

Parameters
otherOther matrix.
Returns
Reference to this modified matrix.

◆ operator-()

template<typename Real>
Matrix3 nnm::Matrix3< Real >::operator- ( const Matrix3< Real > & other) const
inlinenodiscardconstexpr

Element-wise subtraction.

Parameters
otherOther matrix.
Returns
Result.

◆ operator-=()

template<typename Real>
Matrix3 & nnm::Matrix3< Real >::operator-= ( const Matrix3< Real > & other)
inlineconstexpr

Element-wise subtraction.

Parameters
otherOther matrix.
Returns
Reference to this modified matrix.

◆ operator/()

template<typename Real>
Matrix3 nnm::Matrix3< Real >::operator/ ( const Real value) const
inlinenodiscardconstexpr

Element-wise division by value.

Parameters
valueValue.
Returns
Result.

◆ operator/=()

template<typename Real>
Matrix3 & nnm::Matrix3< Real >::operator/= ( const Real value)
inlineconstexpr

Element-wise division by value.

Parameters
valueValue.
Returns
Reference this modified matrix.

◆ operator<()

template<typename Real>
bool nnm::Matrix3< Real >::operator< ( const Matrix3< Real > & other) const
inlinenodiscardconstexpr

Lexicographical comparison between elements.

Parameters
otherOther matrix.
Returns
True if less than, false otherwise.

◆ operator==()

template<typename Real>
bool nnm::Matrix3< Real >::operator== ( const Matrix3< Real > & other) const
inlinenodiscardconstexpr

Element-wise equality.

Parameters
otherOther matrix.
Returns
True if equal, false otherwise.

◆ operator[]() [1/2]

template<typename Real>
Vector3< Real > & nnm::Matrix3< Real >::operator[] ( const uint8_t column)
inlineconstexpr

Reference to column at index.

Parameters
columnColumn.
Returns
Reference.

◆ operator[]() [2/2]

template<typename Real>
const Vector3< Real > & nnm::Matrix3< Real >::operator[] ( const uint8_t column) const
inlineconstexpr

Constant reference to column at index.

Parameters
columnColumn.
Returns
Constant reference.

◆ trace()

template<typename Real>
Real nnm::Matrix3< Real >::trace ( ) const
inlinenodiscardconstexpr

Sum of matrix diagonal.

Returns
Result.

◆ transpose()

template<typename Real>
Matrix3 nnm::Matrix3< Real >::transpose ( ) const
inlinenodiscardconstexpr

Transpose matrix.

Returns
Result.

◆ unchecked_inverse()

template<typename Real>
Matrix3 nnm::Matrix3< Real >::unchecked_inverse ( ) const
inlinenodiscardconstexpr

Inverse without first checking if the matrix is singular.

Returns
Result.

◆ zero()

template<typename Real>
constexpr Matrix3 nnm::Matrix3< Real >::zero ( )
inlinestaticnodiscardconstexpr

Matrix with all elements zero.

Returns
Result.

Member Data Documentation

◆ columns

template<typename Real>
Vector3<Real> nnm::Matrix3< Real >::columns[3]

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