Photon Quantum 3.0.0

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

override Int32 GetHashCode ()
 Calculates the hash code for the FPMatrix2x2 object. More...
 
FPVector2 MultiplyVector (FPVector2 v)
 Transforms a direction by this matrix. More...
 
override String ToString ()
 Returns a string representation of the current FPMatrix2x2 object. 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 FromColumns (FPVector2 column0, FPVector2 column1)
 Create from columns - first vector set the first column, second vector set 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 FromRows (FPVector2 row0, FPVector2 row1)
 Create from rows - first vector set the first row, second vector set the 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...
 
static unsafe void Serialize (void *ptr, IDeterministicFrameSerializer serializer)
 Serializes the FPMatrix2x2 instance into a byte stream using the specified serializer. More...
 

Public Attributes

bool IsIdentity
 Returns true if this matrix is equal to the Identity matrix More...
 
FP M00
 The value of the element at the first row and first column of a 2x2 matrix. More...
 
FP M01
 The value of the element at the first row and second column of a 2x2 matrix. More...
 
FP M10
 The value of the element at the second row and second column of a 2x2 matrix. More...
 
FP M11
 The value of the element at the second row and first column of a 2x2 matrix. More...
 

Static Public Attributes

const int SIZE = FP.SIZE * 4
 The size of the struct in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More...
 
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() [1/2]

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.

◆ FromRows() [2/2]

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.FromRows ( FPVector2  row0,
FPVector2  row1 
)
inlinestatic

Create from rows - first vector set the first row, second vector set the second row.

◆ FromColumns() [1/2]

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.

◆ FromColumns() [2/2]

static FPMatrix2x2 Photon.Deterministic.FPMatrix2x2.FromColumns ( FPVector2  column0,
FPVector2  column1 
)
inlinestatic

Create from columns - first vector set the first column, second vector set 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.

◆ Serialize()

static unsafe void Photon.Deterministic.FPMatrix2x2.Serialize ( void *  ptr,
IDeterministicFrameSerializer  serializer 
)
inlinestatic

Serializes the FPMatrix2x2 instance into a byte stream using the specified serializer.

Parameters
ptrA pointer to the FPMatrix2x2 instance.
serializerThe serializer used to write the data.

◆ ToString()

override String Photon.Deterministic.FPMatrix2x2.ToString ( )
inline

Returns a string representation of the current FPMatrix2x2 object.

Returns
A string that represents the current FPMatrix2x2 object. The string is formatted as "(({0}, {1}), ({2}, {3}))" where {0} represents the value of M00, {1} represents the value of M01, {2} represents the value of M10, and {3} represents the value of M11. The values are formatted using the InvariantCulture.

◆ GetHashCode()

override Int32 Photon.Deterministic.FPMatrix2x2.GetHashCode ( )
inline

Calculates the hash code for the FPMatrix2x2 object.

Returns
The hash code value for the current instance.

◆ 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

◆ SIZE

const int Photon.Deterministic.FPMatrix2x2.SIZE = FP.SIZE * 4
static

The size of the struct in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.

◆ Zero

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

Matrix with 0s in every cell.

◆ M00

FP Photon.Deterministic.FPMatrix2x2.M00

The value of the element at the first row and first column of a 2x2 matrix.

◆ M10

FP Photon.Deterministic.FPMatrix2x2.M10

The value of the element at the second row and second column of a 2x2 matrix.

◆ M01

FP Photon.Deterministic.FPMatrix2x2.M01

The value of the element at the first row and second column of a 2x2 matrix.

◆ M11

FP Photon.Deterministic.FPMatrix2x2.M11

The value of the element at the second row and first column of a 2x2 matrix.

◆ IsIdentity

bool Photon.Deterministic.FPMatrix2x2.IsIdentity
Initial value:
=> M00.RawValue == FP.RAW_ONE &&
M11.RawValue == FP.RAW_ONE &&

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.

Photon.Deterministic.FPMatrix2x2.M10
FP M10
The value of the element at the second row and second column of a 2x2 matrix.
Definition: FPMatrix2x2.cs:47
Photon.Deterministic.FPMatrix2x2.M00
FP M00
The value of the element at the first row and first column of a 2x2 matrix.
Definition: FPMatrix2x2.cs:41
Photon.Deterministic.FP.RawValue
Int64 RawValue
The raw integer value of the fixed-point number.
Definition: FP.cs:156
Photon.Deterministic.FPMatrix2x2.M11
FP M11
The value of the element at the second row and first column of a 2x2 matrix.
Definition: FPMatrix2x2.cs:59
Photon.Deterministic.FPMatrix2x2.M01
FP M01
The value of the element at the first row and second column of a 2x2 matrix.
Definition: FPMatrix2x2.cs:53