Photon Quantum 2.1.1

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Photon.Deterministic.FPMatrix2x2 Struct Reference

Represents 2x2 column major matrix, which can be used for 2D scaling and rotation. Each cell can be individually accessed as a field (M<row><column>). More...

Public Member Functions

FPVector2 MultiplyVector (FPVector2 v)
 Transforms a direction by this matrix. More...
 

Static Public Member Functions

static FPMatrix2x2 FromColumns (FP m00, FP m10, FP m01, FP m11)
 Create from columns - first two values set the first colunn, second two values - second column. More...
 
static FPMatrix2x2 FromRows (FP m00, FP m01, FP m10, FP m11)
 Create from columns - first two values set the first row, second two values - second row. More...
 
static FPMatrix2x2 operator* (FP a, FPMatrix2x2 m)
 Multiplies a matrix by a factor. More...
 
static FPMatrix2x2 operator* (FPMatrix2x2 a, FPMatrix2x2 b)
 Multiplies two matrices. More...
 
static FPVector2 operator* (FPMatrix2x2 m, FPVector2 vector)
 Multiplies a vector by a matrix. More...
 
static FPMatrix2x2 operator+ (FPMatrix2x2 a, FPMatrix2x2 b)
 Adds two matrices. More...
 
static FPMatrix2x2 operator- (FPMatrix2x2 a, FPMatrix2x2 b)
 Subtracts two matrices. More...
 
static FPMatrix2x2 Rotate (FP rotation)
 Creates a rotation matrix. More...
 
static FPMatrix2x2 Scale (FPVector2 scale)
 Creates a scaling matrix. More...
 

Public Attributes

bool IsIdentity
 Returns true if this matrix is equal to the Identity matrix More...
 

Static Public Attributes

static FPMatrix2x2 Zero => new FPMatrix2x2()
 Matrix with 0s in every cell. More...
 

Properties

FP Determinant [get]
 Calculates determinant of this matrix. More...
 
static FPMatrix2x2 Identity [get]
 Matrix with 1s in the main diagonal and 0s in all other cells. More...
 
FPMatrix2x2 Inverted [get]
 Creates inverted matrix. Matrix with determinant 0 can not be inverted and result with Zero. More...
 
FPVector2 LossyScale [get]
 Attempts to get a scale value from the matrix. More...
 
FP this[int index] [get, set]
 Gets or sets cell M<index%4><index/4> More...
 

Detailed Description

Represents 2x2 column major matrix, which can be used for 2D scaling and rotation. Each cell can be individually accessed as a field (M<row><column>).

Member Function Documentation

◆ FromRows()

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.FromRows ( FP  m00,
FP  m01,
FP  m10,
FP  m11 
)
inlinestatic

Create from columns - first two values set the first row, second two values - second row.

◆ FromColumns()

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.FromColumns ( FP  m00,
FP  m10,
FP  m01,
FP  m11 
)
inlinestatic

Create from columns - first two values set the first colunn, second two values - second column.

◆ Rotate()

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.Rotate ( FP  rotation)
inlinestatic

Creates a rotation matrix.

Parameters
rotationRotation in radians.

◆ Scale()

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.Scale ( FPVector2  scale)
static

Creates a scaling matrix.

◆ MultiplyVector()

FPVector2 Photon.Deterministic.FPMatrix2x2.MultiplyVector ( FPVector2  v)
inline

Transforms a direction by this matrix.

◆ operator+()

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.operator+ ( FPMatrix2x2  a,
FPMatrix2x2  b 
)
inlinestatic

Adds two matrices.

◆ operator-()

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.operator- ( FPMatrix2x2  a,
FPMatrix2x2  b 
)
inlinestatic

Subtracts two matrices.

◆ operator*() [1/3]

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.operator* ( FPMatrix2x2  a,
FPMatrix2x2  b 
)
inlinestatic

Multiplies two matrices.

◆ operator*() [2/3]

static FPVector2 Photon.Deterministic.FPMatrix2x2.operator* ( FPMatrix2x2  m,
FPVector2  vector 
)
inlinestatic

Multiplies a vector by a matrix.

◆ operator*() [3/3]

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.operator* ( FP  a,
FPMatrix2x2  m 
)
inlinestatic

Multiplies a matrix by a factor.

Member Data Documentation

◆ Zero

FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.Zero => new FPMatrix2x2()
static

Matrix with 0s in every cell.

◆ IsIdentity

bool Photon.Deterministic.FPMatrix2x2.IsIdentity
Initial value:
=> M00.RawValue == FP.RAW_ONE &&
M11.RawValue == FP.RAW_ONE &&
(M01.RawValue | M10.RawValue) == 0

Returns true if this matrix is equal to the Identity matrix

Property Documentation

◆ Identity

FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.Identity
staticget

Matrix with 1s in the main diagonal and 0s in all other cells.

◆ this[int index]

FP Photon.Deterministic.FPMatrix2x2.this[int index]
getset

Gets or sets cell M<index%4><index/4>

Parameters
index
Returns

◆ LossyScale

FPVector2 Photon.Deterministic.FPMatrix2x2.LossyScale
get

Attempts to get a scale value from the matrix.

◆ Inverted

FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.Inverted
get

Creates inverted matrix. Matrix with determinant 0 can not be inverted and result with Zero.

◆ Determinant

FP Photon.Deterministic.FPMatrix2x2.Determinant
get

Calculates determinant of this matrix.