Photon Quantum 3.0.0

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

Represents 3x3 column major matrix. Each cell can be individually accessed as a field (M<row><column>), with indexing indexing property[row, column] or with indexing property[index]. More...

Public Member Functions

override Int32 GetHashCode ()
 Calculates the hash code for the current FPMatrix3x3 instance. More...
 
override String ToString ()
 Converts the FPMatrix3x3 to a string representation. The returned string has the format "(({0}, {1}, {2}), ({3}, {4}, {5}), ({6}, {7}, {8}))", where {0} to {8} are the formatted string representations of the matrix elements. More...
 

Static Public Member Functions

static FPMatrix3x3 FromColumns (FP m00, FP m10, FP m20, FP m01, FP m11, FP m21, FP m02, FP m12, FP m22)
 Create from columns - first three values set the first column, second three values - second column etc. More...
 
static FPMatrix3x3 FromColumns (FPVector3 column0, FPVector3 column1, FPVector3 column2)
 Create from columns - the first vector set the first column, second vector - second column etc. More...
 
static FPMatrix3x3 FromRows (FP m00, FP m01, FP m02, FP m10, FP m11, FP m12, FP m20, FP m21, FP m22)
 Create from rows - first three values set the first row, second three values - second row etc. More...
 
static FPMatrix3x3 FromRows (FPVector3 row0, FPVector3 row1, FPVector3 row2)
 Create from rows - the first vector set the first row, second vector - second row etc. More...
 
static FPMatrix3x3 InverseRotateScale (FPQuaternion q, FPVector3 s)
 Creates an inverse rotation and scaling matrix. This is significantly faster than inverting a RotateScale matrix. Rotation is expected to be normalized. More...
 
static FPMatrix3x3 operator* (FP a, FPMatrix3x3 m)
 Multiplies a matrix by a factor. More...
 
static FPMatrix3x3 operator* (FPMatrix3x3 a, FPMatrix3x3 b)
 Multiplies two matrices. More...
 
static FPVector3 operator* (FPMatrix3x3 m, FPVector3 vector)
 Multiplies a vector by a matrix. More...
 
static FPMatrix3x3 operator+ (FPMatrix3x3 a, FPMatrix3x3 b)
 Adds two matrices. More...
 
static FPMatrix3x3 operator- (FPMatrix3x3 a, FPMatrix3x3 b)
 Subtracts two matrices. More...
 
static FPMatrix3x3 Rotate (FPQuaternion q)
 Creates a rotation matrix. Rotation is expected to be normalized. More...
 
static FPMatrix3x3 RotateScale (FPQuaternion q, FPVector3 s)
 Creates a rotation and scaling matrix. Rotation is expected to be normalized. More...
 
static FPMatrix3x3 Scale (FPVector3 scale)
 Creates a scaling matrix. More...
 
static void Serialize (void *ptr, IDeterministicFrameSerializer serializer)
 Serializes an instance of FPMatrix3x3 using the given IDeterministicFrameSerializer. More...
 

Public Attributes

bool IsIdentity
 Returns true if this matrix is equal to the Identity matrix More...
 
FP M00
 First row, first column More...
 
FP M01
 First row, second column More...
 
FP M02
 First row, third column More...
 
FP M10
 Second row, first column More...
 
FP M11
 Second row, second column More...
 
FP M12
 Second row, third column More...
 
FP M20
 Third row, first column More...
 
FP M21
 Third row, second column More...
 
FP M22
 Third row, third column More...
 
FPMatrix3x3 Transposed => FromColumns(M00, M01, M02, M10, M11, M12, M20, M21, M22)
 Creates transposed matrix. More...
 

Static Public Attributes

const int SIZE = FP.SIZE * 9
 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 FPMatrix3x3 Zero => new FPMatrix3x3()
 Matrix with 0s in every cell. More...
 

Properties

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

Detailed Description

Represents 3x3 column major matrix. Each cell can be individually accessed as a field (M<row><column>), with indexing indexing property[row, column] or with indexing property[index].

Member Function Documentation

◆ FromRows() [1/2]

static FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.FromRows ( FP  m00,
FP  m01,
FP  m02,
FP  m10,
FP  m11,
FP  m12,
FP  m20,
FP  m21,
FP  m22 
)
inlinestatic

Create from rows - first three values set the first row, second three values - second row etc.

◆ FromRows() [2/2]

static FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.FromRows ( FPVector3  row0,
FPVector3  row1,
FPVector3  row2 
)
inlinestatic

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

◆ FromColumns() [1/2]

static FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.FromColumns ( FP  m00,
FP  m10,
FP  m20,
FP  m01,
FP  m11,
FP  m21,
FP  m02,
FP  m12,
FP  m22 
)
inlinestatic

Create from columns - first three values set the first column, second three values - second column etc.

◆ FromColumns() [2/2]

static FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.FromColumns ( FPVector3  column0,
FPVector3  column1,
FPVector3  column2 
)
inlinestatic

Create from columns - the first vector set the first column, second vector - second column etc.

◆ Scale()

static FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.Scale ( FPVector3  scale)
static

Creates a scaling matrix.

Parameters
scale
Returns

◆ Serialize()

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

Serializes an instance of FPMatrix3x3 using the given IDeterministicFrameSerializer.

Parameters
ptrA pointer to the instance of FPMatrix3x3 to be serialized.
serializerThe IDeterministicFrameSerializer used for serialization.

◆ ToString()

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

Converts the FPMatrix3x3 to a string representation. The returned string has the format "(({0}, {1}, {2}), ({3}, {4}, {5}), ({6}, {7}, {8}))", where {0} to {8} are the formatted string representations of the matrix elements.

Returns
A string representation of the FPMatrix3x3.

◆ GetHashCode()

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

Calculates the hash code for the current FPMatrix3x3 instance.

Returns
The calculated hash code.

◆ operator+()

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

Adds two matrices.

◆ operator-()

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

Subtracts two matrices.

◆ operator*() [1/3]

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

Multiplies two matrices.

◆ operator*() [2/3]

static FPVector3 Photon.Deterministic.FPMatrix3x3.operator* ( FPMatrix3x3  m,
FPVector3  vector 
)
inlinestatic

Multiplies a vector by a matrix.

◆ operator*() [3/3]

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

Multiplies a matrix by a factor.

◆ Rotate()

static FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.Rotate ( FPQuaternion  q)
inlinestatic

Creates a rotation matrix. Rotation is expected to be normalized.

◆ RotateScale()

static FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.RotateScale ( FPQuaternion  q,
FPVector3  s 
)
inlinestatic

Creates a rotation and scaling matrix. Rotation is expected to be normalized.

◆ InverseRotateScale()

static FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.InverseRotateScale ( FPQuaternion  q,
FPVector3  s 
)
inlinestatic

Creates an inverse rotation and scaling matrix. This is significantly faster than inverting a RotateScale matrix. Rotation is expected to be normalized.

Member Data Documentation

◆ SIZE

const int Photon.Deterministic.FPMatrix3x3.SIZE = FP.SIZE * 9
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

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

Matrix with 0s in every cell.

◆ M00

FP Photon.Deterministic.FPMatrix3x3.M00

First row, first column

◆ M10

FP Photon.Deterministic.FPMatrix3x3.M10

Second row, first column

◆ M20

FP Photon.Deterministic.FPMatrix3x3.M20

Third row, first column

◆ M01

FP Photon.Deterministic.FPMatrix3x3.M01

First row, second column

◆ M11

FP Photon.Deterministic.FPMatrix3x3.M11

Second row, second column

◆ M21

FP Photon.Deterministic.FPMatrix3x3.M21

Third row, second column

◆ M02

FP Photon.Deterministic.FPMatrix3x3.M02

First row, third column

◆ M12

FP Photon.Deterministic.FPMatrix3x3.M12

Second row, third column

◆ M22

FP Photon.Deterministic.FPMatrix3x3.M22

Third row, third column

◆ Transposed

FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.Transposed => FromColumns(M00, M01, M02, M10, M11, M12, M20, M21, M22)

Creates transposed matrix.

◆ IsIdentity

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

Returns true if this matrix is equal to the Identity matrix

Property Documentation

◆ Identity

FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.Identity
staticget

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

◆ this[int row, int column]

FP Photon.Deterministic.FPMatrix3x3.this[int row, int column]
getset

Gets or sets cell M<row><column>.

Parameters
row
column
Returns

◆ this[int index]

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

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

Parameters
index
Returns

◆ LossyScale

FPVector3 Photon.Deterministic.FPMatrix3x3.LossyScale
get

Attempts to get a scale value from the matrix.

◆ Inverted

FPMatrix3x3 Photon.Deterministic.FPMatrix3x3.Inverted
get

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

◆ Determinant

FP Photon.Deterministic.FPMatrix3x3.Determinant
get

Calculates determinant of this matrix.

◆ Rotation

FPQuaternion Photon.Deterministic.FPMatrix3x3.Rotation
get

Attempts to get a rotation quaternion from this matrix.

Photon.Deterministic.FPMatrix3x3.M11
FP M11
Second row, second column
Definition: FPMatrix3x3.cs:49
Photon.Deterministic.FPMatrix3x3.M12
FP M12
Second row, third column
Definition: FPMatrix3x3.cs:55
Photon.Deterministic.FPMatrix3x3.M01
FP M01
First row, second column
Definition: FPMatrix3x3.cs:47
Photon.Deterministic.FPMatrix3x3.M22
FP M22
Third row, third column
Definition: FPMatrix3x3.cs:57
Photon.Deterministic.FPMatrix3x3.M10
FP M10
Second row, first column
Definition: FPMatrix3x3.cs:43
Photon.Deterministic.FP.RawValue
Int64 RawValue
The raw integer value of the fixed-point number.
Definition: FP.cs:156
Photon.Deterministic.FPMatrix3x3.M02
FP M02
First row, third column
Definition: FPMatrix3x3.cs:53
Photon.Deterministic.FPMatrix3x3.M21
FP M21
Third row, second column
Definition: FPMatrix3x3.cs:51
Photon.Deterministic.FPMatrix3x3.M00
FP M00
First row, first column
Definition: FPMatrix3x3.cs:41
Photon.Deterministic.FPMatrix3x3.M20
FP M20
Third row, first column
Definition: FPMatrix3x3.cs:45