Math v0.0.1
float2x2

Floating point 2x2 matrix structure. More...

#include <float.hpp>

Public Member Functions

constexpr float2x2 (float n=0.0f) noexcept
 Creates a new floating point 2x2 matrix structure.
 
constexpr float2x2 (float c0r0, float c1r0, float c0r1, float c1r1) noexcept
 Creates a new floating point 2x2 matrix structure.
 
constexpr float2x2 (float2 c0, float2 c1) noexcept
 Creates a new floating point 2x2 matrix structure.
 
float2operator[] (psize i) noexcept
 Returns matrix column by index.
 
float2 operator[] (psize i) const noexcept
 Returns matrix column by index.
 
constexpr float2x2 operator+ (float n) const noexcept
 
constexpr float2x2 operator- (float n) const noexcept
 
constexpr float2x2 operator* (float n) const noexcept
 
constexpr float2x2 operator/ (float n) const noexcept
 
float2x2operator+= (float n) noexcept
 
float2x2operator-= (float n) noexcept
 
float2x2operator*= (float n) noexcept
 
float2x2operator/= (float n) noexcept
 
constexpr float2x2 operator* (float2x2 m) const noexcept
 Calculates dot product between two matrices.
 
constexpr float2 operator* (float2 v) const noexcept
 Calculates dot product between matrix and vector.
 
float2x2operator*= (const float2x2 &m) noexcept
 Calculates dot product between two matrices.
 
bool operator== (const float2x2 &m) const noexcept
 Returns true if matrices have the same values.
 
bool operator!= (const float2x2 &m) const noexcept
 Returns true if matrices have different values.
 

Public Attributes

float2 c0
 
float2 c1
 

Static Public Attributes

static const float2x2 zero = float2x2(0.0f)
 
static const float2x2 one = float2x2(1.0f)
 
static const float2x2 minusOne = float2x2(-1.0f)
 
static const float2x2 identity
 

Detailed Description

Floating point 2x2 matrix structure.

Commonly used for basic transformations: translation, scale, rotation, etc.

Constructor & Destructor Documentation

◆ float2x2() [1/3]

constexpr float2x2 ( float n = 0.0f)
inlineexplicitconstexprnoexcept

Creates a new floating point 2x2 matrix structure.

Parameters
ntarget value for all columns and rows

◆ float2x2() [2/3]

constexpr float2x2 ( float c0r0,
float c1r0,
float c0r1,
float c1r1 )
inlineconstexprnoexcept

Creates a new floating point 2x2 matrix structure.

See the float2x2.

◆ float2x2() [3/3]

constexpr float2x2 ( float2 c0,
float2 c1 )
inlineconstexprnoexcept

Creates a new floating point 2x2 matrix structure.

Parameters
c0first matrix column value
c1second matrix column value

Member Function Documentation

◆ operator[]() [1/2]

float2 & operator[] ( psize i)
inlinenoexcept

Returns matrix column by index.

Parameters
itarget column index

◆ operator[]() [2/2]

float2 operator[] ( psize i) const
inlinenoexcept

Returns matrix column by index.

Parameters
itarget column index

◆ operator*() [1/2]

constexpr float2x2 operator* ( float2x2 m) const
inlineconstexprnoexcept

Calculates dot product between two matrices.

Parameters
mtarget matrix to dot by

◆ operator*() [2/2]

constexpr float2 operator* ( float2 v) const
inlineconstexprnoexcept

Calculates dot product between matrix and vector.

Parameters
vtarget vector to dot by

◆ operator*=()

float2x2 & operator*= ( const float2x2 & m)
inlinenoexcept

Calculates dot product between two matrices.

Parameters
[in]mtarget matrix to dot by

◆ operator==()

bool operator== ( const float2x2 & m) const
inlinenoexcept

Returns true if matrices have the same values.

Parameters
[in]manother matrix to compare with

◆ operator!=()

bool operator!= ( const float2x2 & m) const
inlinenoexcept

Returns true if matrices have different values.

Parameters
[in]manother matrix to compare with

Member Data Documentation

◆ c0

float2 c0

First matrix column.

◆ c1

float2 c1

Second matrix column.

◆ identity

const float2x2 identity
inlinestatic
Initial value:
1.0f, 0.0f,
0.0f, 1.0f)
constexpr float2x2(float n=0.0f) noexcept
Creates a new floating point 2x2 matrix structure.
Definition float.hpp:45