A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Kinoko::EGG::Matrix34f Class Reference

#include <Matrix.hh>

Description

A 3 x 4 matrix.

Definition at line 10 of file Matrix.hh.

Public Member Functions

constexpr Matrix34f (f32 _e00, f32 _e01, f32 _e02, f32 _e03, f32 _e10, f32 _e11, f32 _e12, f32 _e13, f32 _e20, f32 _e21, f32 _e22, f32 _e23)
 
constexpr bool operator== (const Matrix34f &rhs) const
 
constexpr f32 & operator[] (size_t row, size_t col)
 Accesses the matrix element at the specified row and column.
 
constexpr f32 operator[] (size_t row, size_t col) const
 Accesses the matrix element at the specified row and column.
 
constexpr void makeQT (const Quatf &q, const Vector3f &t)
 Sets matrix from rotation and position.
 
constexpr void makeQ (const Quatf &q)
 Sets rotation matrix from quaternion.
 
constexpr void makeRT (const Vector3f &r, const Vector3f &t)
 Sets rotation-translation matrix.
 
constexpr void makeR (const Vector3f &r)
 Sets 3x3 rotation matrix from a vector of Euler angles.
 
constexpr void makeS (const Vector3f &s)
 
constexpr void makeT (const Vector3f &t)
 
constexpr void makeZero ()
 Zeroes every element of the matrix.
 
constexpr void makeOrthonormalBasis (const Vector3f &forward, const Vector3f &up)
 Sets a 3x3 orthonormal basis for a local coordinate system.
 
constexpr void makeOrthonormalBasisLocal (Vector3f forward, Vector3f up)
 
constexpr void setAxisRotation (f32 angle, const EGG::Vector3f &axis)
 Rotates the matrix about an axis.
 
constexpr void mulRow33 (size_t rowIdx, const Vector3f &row)
 Multiplies one row of a 3x3 matrix by a vector.
 
constexpr void setBase (size_t col, const Vector3f &base)
 Sets one column of a matrix.
 
constexpr Matrix34f multiplyTo (const Matrix34f &rhs) const
 Multiplies two matrices.
 
constexpr Vector3f multVector (const Vector3f &vec) const
 Multiplies a vector by a matrix.
 
constexpr Vector3f ps_multVector (const Vector3f &vec) const
 Paired-singles impl. of multVector.
 
constexpr Vector3f multVector33 (const Vector3f &vec) const
 Multiplies a 3x3 matrix by a vector.
 
constexpr Vector3f calcRPY () const
 
constexpr Vector3f ps_multVector33 (const Vector3f &vec) const
 Paired-singles impl. of multVector33.
 
constexpr void inverseTo33 (Matrix34f &out) const
 Inverts the 3x3 portion of the 3x4 matrix.
 
constexpr bool ps_inverse (Matrix34f &out) const
 
constexpr Matrix34f transpose () const
 Transposes the 3x3 portion of the matrix.
 
constexpr Vector3f translation () const
 
constexpr Vector3f base (size_t col) const
 Get a particular column from a matrix.
 

Static Public Attributes

static const Matrix34f ident
 
static const Matrix34f zero
 

Private Attributes

union { 
 
   std::array< std::array< f32, 4 >, 3 >   mtx 
 
   std::array< f32, 12 >   a 
 
};  
 

Constructor & Destructor Documentation

◆ Matrix34f()

Kinoko::EGG::Matrix34f::Matrix34f ( f32 _e00,
f32 _e01,
f32 _e02,
f32 _e03,
f32 _e10,
f32 _e11,
f32 _e12,
f32 _e13,
f32 _e20,
f32 _e21,
f32 _e22,
f32 _e23 )
inlineconstexpr

Definition at line 20 of file Matrix.hh.

Member Function Documentation

◆ base()

Vector3f Kinoko::EGG::Matrix34f::base ( size_t col) const
inlinenodiscardconstexpr0x80537B80

Get a particular column from a matrix.

Definition at line 408 of file Matrix.hh.

◆ calcRPY()

Vector3f Kinoko::EGG::Matrix34f::calcRPY ( ) const
inlinenodiscardconstexpr0x8067EAEC0x8022FB04

Definition at line 296 of file Matrix.hh.

◆ inverseTo33()

void Kinoko::EGG::Matrix34f::inverseTo33 ( Matrix34f & out) const
inlineconstexpr0x8022F90C

Inverts the 3x3 portion of the 3x4 matrix.

Unlike a typical matrix inversion, if the determinant is 0, then this function returns the identity matrix.

Definition at line 331 of file Matrix.hh.

◆ makeOrthonormalBasis()

void Kinoko::EGG::Matrix34f::makeOrthonormalBasis ( const Vector3f & forward,
const Vector3f & up )
inlineconstexpr0x805AE7B4

Sets a 3x3 orthonormal basis for a local coordinate system.

In a vector's orthogonal space, there are infinitely many vector pairs orthogonal to each other. To specify a particular pair and create a local coordinate system, a reference up vector from an existing coordinate system is provided.

Parameters
forwardThe forward axis of the local coordinate system.
upThe reference up axis from an existing coordinate system.

Definition at line 190 of file Matrix.hh.

◆ makeOrthonormalBasisLocal()

void Kinoko::EGG::Matrix34f::makeOrthonormalBasisLocal ( Vector3f forward,
Vector3f up )
inlineconstexpr0x80537740

Definition at line 202 of file Matrix.hh.

◆ makeQ()

void Kinoko::EGG::Matrix34f::makeQ ( const Quatf & q)
inlineconstexpr0x8023030C

Sets rotation matrix from quaternion.

Definition at line 72 of file Matrix.hh.

◆ makeQT()

void Kinoko::EGG::Matrix34f::makeQT ( const Quatf & q,
const Vector3f & t )
inlineconstexpr0x80230118

Sets matrix from rotation and position.

Definition at line 42 of file Matrix.hh.

◆ makeR()

void Kinoko::EGG::Matrix34f::makeR ( const Vector3f & r)
inlineconstexpr0x8022FF98

Sets 3x3 rotation matrix from a vector of Euler angles.

Definition at line 129 of file Matrix.hh.

◆ makeRT()

void Kinoko::EGG::Matrix34f::makeRT ( const Vector3f & r,
const Vector3f & t )
inlineconstexpr0x8022FE14

Sets rotation-translation matrix.

Definition at line 102 of file Matrix.hh.

◆ makeS()

void Kinoko::EGG::Matrix34f::makeS ( const Vector3f & s)
inlineconstexpr0x80230280

Definition at line 155 of file Matrix.hh.

◆ makeT()

void Kinoko::EGG::Matrix34f::makeT ( const Vector3f & t)
inlineconstexpr0x802302C4

Definition at line 163 of file Matrix.hh.

◆ makeZero()

void Kinoko::EGG::Matrix34f::makeZero ( )
inlineconstexpr

Zeroes every element of the matrix.

Definition at line 179 of file Matrix.hh.

◆ mulRow33()

void Kinoko::EGG::Matrix34f::mulRow33 ( size_t rowIdx,
const Vector3f & row )
inlineconstexpr

Multiplies one row of a 3x3 matrix by a vector.

Definition at line 223 of file Matrix.hh.

◆ multiplyTo()

Matrix34f Kinoko::EGG::Matrix34f::multiplyTo ( const Matrix34f & rhs) const
inlinenodiscardconstexpr0x802304100x80199D64

Multiplies two matrices.

Definition at line 238 of file Matrix.hh.

◆ multVector()

Vector3f Kinoko::EGG::Matrix34f::multVector ( const Vector3f & vec) const
inlinenodiscardconstexpr

Multiplies a vector by a matrix.

Definition at line 261 of file Matrix.hh.

◆ multVector33()

Vector3f Kinoko::EGG::Matrix34f::multVector33 ( const Vector3f & vec) const
inlinenodiscardconstexpr0x8059A4F8

Multiplies a 3x3 matrix by a vector.

Definition at line 285 of file Matrix.hh.

◆ operator==()

bool Kinoko::EGG::Matrix34f::operator== ( const Matrix34f & rhs) const
inlineconstexpr

Definition at line 26 of file Matrix.hh.

◆ operator[]() [1/2]

f32 & Kinoko::EGG::Matrix34f::operator[] ( size_t row,
size_t col )
inlinenodiscardconstexpr

Accesses the matrix element at the specified row and column.

Definition at line 31 of file Matrix.hh.

◆ operator[]() [2/2]

f32 Kinoko::EGG::Matrix34f::operator[] ( size_t row,
size_t col ) const
inlinenodiscardconstexpr

Accesses the matrix element at the specified row and column.

Definition at line 36 of file Matrix.hh.

◆ ps_inverse()

bool Kinoko::EGG::Matrix34f::ps_inverse ( Matrix34f & out) const
inlineconstexpr0x80199FC8

@warn The out reference will not be initialized if the matrix is singular.

Returns
Whether or not the matrix is invertible.

Definition at line 360 of file Matrix.hh.

◆ ps_multVector()

Vector3f Kinoko::EGG::Matrix34f::ps_multVector ( const Vector3f & vec) const
inlinenodiscardconstexpr0x802303F8

Paired-singles impl. of multVector.

Definition at line 273 of file Matrix.hh.

◆ ps_multVector33()

Vector3f Kinoko::EGG::Matrix34f::ps_multVector33 ( const Vector3f & vec) const
inlinenodiscardconstexpr0x8019A970

Paired-singles impl. of multVector33.

Definition at line 317 of file Matrix.hh.

◆ setAxisRotation()

void Kinoko::EGG::Matrix34f::setAxisRotation ( f32 angle,
const EGG::Vector3f & axis )
inlineconstexpr0x802303BC

Rotates the matrix about an axis.

Definition at line 216 of file Matrix.hh.

◆ setBase()

void Kinoko::EGG::Matrix34f::setBase ( size_t col,
const Vector3f & base )
inlineconstexpr

Sets one column of a matrix.

Definition at line 230 of file Matrix.hh.

◆ translation()

Vector3f Kinoko::EGG::Matrix34f::translation ( ) const
inlinenodiscardconstexpr

Definition at line 402 of file Matrix.hh.

◆ transpose()

Matrix34f Kinoko::EGG::Matrix34f::transpose ( ) const
inlinenodiscardconstexpr

Transposes the 3x3 portion of the matrix.

Definition at line 389 of file Matrix.hh.

Member Data Documentation

◆ a

std::array<f32, 12> Kinoko::EGG::Matrix34f::a

Definition at line 418 of file Matrix.hh.

◆ ident

Matrix34f Kinoko::EGG::Matrix34f::ident
inlinestaticconstexpr0x80384370

Definition at line 412 of file Matrix.hh.

◆ mtx

std::array<std::array<f32, 4>, 3> Kinoko::EGG::Matrix34f::mtx

Definition at line 417 of file Matrix.hh.

◆ zero

Matrix34f Kinoko::EGG::Matrix34f::zero
inlinestaticconstexpr

Definition at line 413 of file Matrix.hh.