3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Math::Matrix3x3 Struct Reference

Represents a row-major 3x3 matrix. Used for 2D affine transformations and 3D rotations. More...

#include <Matrix3x3.hpp>

Public Member Functions

 Matrix3x3 (float m11=1, float m12=0, float m13=0, float m21=0, float m22=1, float m23=0, float m31=0, float m32=0, float m33=1)
 Creates a matrix with the specified values. If no values are provided, it creates an identity matrix.
 Matrix3x3 (float m[9])
 Creates a matrix from an array of 9 floats.
float Trace () const noexcept
 Returns the trace of this matrix.
float Determinant () const noexcept
 Returns the determinant of this matrix.
float & operator[] (unsigned index)
 Returns a reference to the element at the specified index in the matrix, allowing for both reading and writing.
Matrix3x3 & Hadamard (const Matrix3x3 &m)
 Hadamard multiplication (element-wise multiplication) of this matrix with another matrix.
Matrix3x3 operator+ (const Matrix3x3 &m) const noexcept
 Adds this matrix to another matrix and returns the result.
Matrix3x3 & operator+= (const Matrix3x3 &m) noexcept
 Adds another matrix to this matrix in-place.
Matrix3x3 operator- () const noexcept
 Negates this matrix, returning a matrix with all elements negated.
Matrix3x3 operator- (const Matrix3x3 &m) const noexcept
 Subtracts another matrix from this matrix and returns the result.
Matrix3x3 & operator-= (const Matrix3x3 &m) noexcept
 Subtracts another matrix from this matrix in-place.
Matrix3x3 operator* (const Matrix3x3 &m) const noexcept
 Multiplies this matrix with another matrix (matrix product) and returns the result.
Matrix3x3 & operator*= (const Matrix3x3 &m) noexcept
 Multiplies this matrix with another matrix (matrix product) in-place.
Matrix3x3 operator* (float s) const noexcept
 Multiplies this matrix by a scalar and returns the result.
Matrix3x3 & operator*= (float s) noexcept
 Multiplies this matrix by a scalar in-place.
Matrix3x3 operator/ (float s) const
 Divides this matrix by a scalar and returns the result.
Matrix3x3 & operator/= (float s)
 Divides this matrix by a scalar in-place.

Static Public Member Functions

static Matrix3x3 CreateTranslation (const Vector2 &t)
 Creates a 2D translation matrix.
static Matrix3x3 CreateScale (const Vector2 &s)
 Creates a 2D scaling matrix.
static Matrix3x3 CreateRotation2D (float theta)
 Creates a 2D rotation matrix.
static Matrix3x3 Create2DSkewing (const Vector2 &skewing)
 Creates a 2D skewing matrix.
static Matrix3x3 CreateRotationX (float alpha)
 Creates a rotation matrix around the X-axis.
static Matrix3x3 CreateRotationY (float beta)
 Creates a rotation matrix around the Y-axis.
static Matrix3x3 CreateRotationZ (float gamma)
 Creates a rotation matrix around the Z-axis.
static Matrix3x3 CreateFromQuaternion (const Quaternion &q)
 Creates a rotation matrix from a quaternion.
static Matrix3x3 Hadamard (const Matrix3x3 &a, const Matrix3x3 &b)
 Hadamard multiplication (element-wise multiplication) of two matrices.

Public Attributes

float M11
float M12
float M13
float M21
float M22
float M23
float M31
float M32
float M33

Detailed Description

Represents a row-major 3x3 matrix. Used for 2D affine transformations and 3D rotations.

Constructor & Destructor Documentation

◆ Matrix3x3() [1/2]

Matrix3x3::Matrix3x3 ( float m11 = 1,
float m12 = 0,
float m13 = 0,
float m21 = 0,
float m22 = 1,
float m23 = 0,
float m31 = 0,
float m32 = 0,
float m33 = 1 )
explicit

Creates a matrix with the specified values. If no values are provided, it creates an identity matrix.

Parameters
m11The value for the first row, first column.
m12The value for the first row, second column.
m13The value for the first row, third column.
m21The value for the second row, first column.
m22The value for the second row, second column.
m23The value for the second row, third column.
m31The value for the third row, first column.
m32The value for the third row, second column.
m33The value for the third row, third column.

◆ Matrix3x3() [2/2]

Matrix3x3::Matrix3x3 ( float m[9])
explicit

Creates a matrix from an array of 9 floats.

Parameters
m

Member Function Documentation

◆ Create2DSkewing()

Matrix3x3 Matrix3x3::Create2DSkewing ( const Vector2 & skewing)
static

Creates a 2D skewing matrix.

Parameters
skewingThe skewing vector.
Returns
The resulting skewing matrix.

◆ CreateFromQuaternion()

Matrix3x3 Matrix3x3::CreateFromQuaternion ( const Quaternion & q)
static

Creates a rotation matrix from a quaternion.

Parameters
qThe quaternion representing the rotation.
Returns
The resulting rotation matrix.

◆ CreateRotation2D()

Matrix3x3 Matrix3x3::CreateRotation2D ( float theta)
static

Creates a 2D rotation matrix.

Parameters
thetaThe rotation angle in radians.
Returns
The resulting rotation matrix.

◆ CreateRotationX()

Matrix3x3 Matrix3x3::CreateRotationX ( float alpha)
static

Creates a rotation matrix around the X-axis.

Parameters
alphaThe rotation angle in radians.
Returns
The resulting rotation matrix.

◆ CreateRotationY()

Matrix3x3 Matrix3x3::CreateRotationY ( float beta)
static

Creates a rotation matrix around the Y-axis.

Parameters
betaThe rotation angle in radians.
Returns
The resulting rotation matrix.

◆ CreateRotationZ()

Matrix3x3 Matrix3x3::CreateRotationZ ( float gamma)
static

Creates a rotation matrix around the Z-axis.

Parameters
gammaThe rotation angle in radians.
Returns
The resulting rotation matrix.

◆ CreateScale()

Matrix3x3 Matrix3x3::CreateScale ( const Vector2 & s)
static

Creates a 2D scaling matrix.

Parameters
sThe scaling vector.
Returns
The resulting scaling matrix.

◆ CreateTranslation()

Matrix3x3 Matrix3x3::CreateTranslation ( const Vector2 & t)
static

Creates a 2D translation matrix.

Parameters
tThe translation vector.
Returns
The resulting translation matrix.

◆ Determinant()

float Matrix3x3::Determinant ( ) const
noexcept

Returns the determinant of this matrix.

Returns
The determinant of the matrix.

◆ Hadamard() [1/2]

Matrix3x3 Matrix3x3::Hadamard ( const Matrix3x3 & a,
const Matrix3x3 & b )
static

Hadamard multiplication (element-wise multiplication) of two matrices.

Parameters
aThe first matrix.
bThe second matrix.
Returns
The resulting matrix after Hadamard multiplication.

◆ Hadamard() [2/2]

Matrix3x3 & Matrix3x3::Hadamard ( const Matrix3x3 & m)

Hadamard multiplication (element-wise multiplication) of this matrix with another matrix.

Parameters
mThe matrix to multiply with.
Returns
The resulting matrix after Hadamard multiplication.

◆ operator*() [1/2]

Matrix3x3 Matrix3x3::operator* ( const Matrix3x3 & m) const
noexcept

Multiplies this matrix with another matrix (matrix product) and returns the result.

Parameters
mThe matrix to multiply with.
Returns
The resulting matrix after multiplication.

◆ operator*() [2/2]

Matrix3x3 Matrix3x3::operator* ( float s) const
noexcept

Multiplies this matrix by a scalar and returns the result.

Parameters
sThe scalar value to multiply with.
Returns
The resulting scaled matrix.

◆ operator*=() [1/2]

Matrix3x3 & Matrix3x3::operator*= ( const Matrix3x3 & m)
noexcept

Multiplies this matrix with another matrix (matrix product) in-place.

Parameters
mThe matrix to multiply with.
Returns
A reference to this matrix after multiplication.

◆ operator*=() [2/2]

Matrix3x3 & Matrix3x3::operator*= ( float s)
noexcept

Multiplies this matrix by a scalar in-place.

Parameters
sThe scalar value to multiply with.
Returns
A reference to this matrix after scaling.

◆ operator+()

Matrix3x3 Matrix3x3::operator+ ( const Matrix3x3 & m) const
noexcept

Adds this matrix to another matrix and returns the result.

Parameters
mThe matrix to add.
Returns
The resulting matrix after addition.

◆ operator+=()

Matrix3x3 & Matrix3x3::operator+= ( const Matrix3x3 & m)
noexcept

Adds another matrix to this matrix in-place.

Parameters
mThe matrix to add.
Returns
A reference to this matrix after addition.

◆ operator-() [1/2]

Matrix3x3 Matrix3x3::operator- ( ) const
noexcept

Negates this matrix, returning a matrix with all elements negated.

Returns
The resulting negated matrix.

◆ operator-() [2/2]

Matrix3x3 Matrix3x3::operator- ( const Matrix3x3 & m) const
noexcept

Subtracts another matrix from this matrix and returns the result.

Parameters
mThe matrix to subtract.
Returns
The resulting matrix after subtraction.

◆ operator-=()

Matrix3x3 & Matrix3x3::operator-= ( const Matrix3x3 & m)
noexcept

Subtracts another matrix from this matrix in-place.

Parameters
mThe matrix to subtract.
Returns
A reference to this matrix after subtraction.

◆ operator/()

Matrix3x3 Matrix3x3::operator/ ( float s) const

Divides this matrix by a scalar and returns the result.

Parameters
sThe scalar value to divide by.
Returns
The resulting divided matrix.

◆ operator/=()

Matrix3x3 & Matrix3x3::operator/= ( float s)

Divides this matrix by a scalar in-place.

Parameters
sThe scalar value to divide by.
Returns
A reference to this matrix after division.

◆ operator[]()

float & Matrix3x3::operator[] ( unsigned index)

Returns a reference to the element at the specified index in the matrix, allowing for both reading and writing.

Parameters
indexIndex. between 0 and 8
Returns
A reference to the element at the specified index.

◆ Trace()

float Matrix3x3::Trace ( ) const
noexcept

Returns the trace of this matrix.

Returns
M11+ M22 + M33

Member Data Documentation

◆ M11

float Engine3DRadSpace.Math::Matrix3x3::M11

◆ M12

float Engine3DRadSpace.Math::Matrix3x3::M12

◆ M13

float Engine3DRadSpace.Math::Matrix3x3::M13

◆ M21

float Engine3DRadSpace.Math::Matrix3x3::M21

◆ M22

float Engine3DRadSpace.Math::Matrix3x3::M22

◆ M23

float Engine3DRadSpace.Math::Matrix3x3::M23

◆ M31

float Engine3DRadSpace.Math::Matrix3x3::M31

◆ M32

float Engine3DRadSpace.Math::Matrix3x3::M32

◆ M33

float Engine3DRadSpace.Math::Matrix3x3::M33

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