Nebula
Loading...
Searching...
No Matches
Mathf.Matrix Struct Reference

Detailed Description

Represents the right-handed 4x4 floating point matrix, which can store translation, scale and rotation information.

Inherits IEquatable< Matrix >.

Public Member Functions

 Matrix (float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
 Constructs a matrix.
 
 Matrix (Vector4 row1, Vector4 row2, Vector4 row3, Vector4 row4)
 Constructs a matrix.
 
bool Decompose (out Vector3 scale, out Quaternion rotation, out Vector3 translation)
 Decomposes this matrix to translation, rotation and scale elements.
 
float Determinant ()
 Returns a determinant of this Matrix.
 
bool Equals (Matrix other)
 Compares whether current instance is equal to specified Matrix without any tolerance.
 
override bool Equals (object obj)
 Compares whether current instance is equal to specified Object without any tolerance.
 
override int GetHashCode ()
 Gets the hash code of this Matrix.
 
override string ToString ()
 Returns a String representation of this Matrix in the format: {M11:[M11] M12:[M12] M13:[M13] M14:[M14]} {M21:[M21] M12:[M22] M13:[M23] M14:[M24]} {M31:[M31] M32:[M32] M33:[M33] M34:[M34]} {M41:[M41] M42:[M42] M43:[M43] M44:[M44]}.
 

Static Public Member Functions

static Matrix Add (Matrix matrix1, Matrix matrix2)
 Creates a new Matrix which contains sum of two matrixes.
 
static void Add (ref Matrix matrix1, ref Matrix matrix2, out Matrix result)
 Creates a new Matrix which contains sum of two matrixes.
 
static Matrix CreateBillboard (Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Nullable< Vector3 > cameraForwardVector)
 Creates a new Matrix for spherical billboarding that rotates around specified object position.
 
static void CreateBillboard (ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 cameraUpVector, Vector3? cameraForwardVector, out Matrix result)
 Creates a new Matrix for spherical billboarding that rotates around specified object position.
 
static Matrix CreateConstrainedBillboard (Vector3 objectPosition, Vector3 cameraPosition, Vector3 rotateAxis, Nullable< Vector3 > cameraForwardVector, Nullable< Vector3 > objectForwardVector)
 Creates a new Matrix for cylindrical billboarding that rotates around specified axis.
 
static void CreateConstrainedBillboard (ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 rotateAxis, Vector3? cameraForwardVector, Vector3? objectForwardVector, out Matrix result)
 Creates a new Matrix for cylindrical billboarding that rotates around specified axis.
 
static Matrix CreateFromAxisAngle (Vector3 axis, float angle)
 Creates a new Matrix which contains the rotation moment around specified axis.
 
static void CreateFromAxisAngle (ref Vector3 axis, float angle, out Matrix result)
 Creates a new Matrix which contains the rotation moment around specified axis.
 
static Matrix CreateFromQuaternion (Quaternion quaternion)
 Creates a new rotation Matrix from a Quaternion.
 
static void CreateFromQuaternion (ref Quaternion quaternion, out Matrix result)
 Creates a new rotation Matrix from a Quaternion.
 
static Matrix CreateFromYawPitchRoll (float yaw, float pitch, float roll)
 Creates a new rotation Matrix from the specified yaw, pitch and roll values.
 
static void CreateFromYawPitchRoll (float yaw, float pitch, float roll, out Matrix result)
 Creates a new rotation Matrix from the specified yaw, pitch and roll values.
 
static Matrix CreateLookAt (Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector)
 Creates a new viewing Matrix.
 
static void CreateLookAt (ref Vector3 cameraPosition, ref Vector3 cameraTarget, ref Vector3 cameraUpVector, out Matrix result)
 Creates a new viewing Matrix.
 
static Matrix CreateOrthographic (float width, float height, float zNearPlane, float zFarPlane)
 Creates a new projection Matrix for orthographic view.
 
static void CreateOrthographic (float width, float height, float zNearPlane, float zFarPlane, out Matrix result)
 Creates a new projection Matrix for orthographic view.
 
static Matrix CreateOrthographicOffCenter (float left, float right, float bottom, float top, float zNearPlane, float zFarPlane)
 Creates a new projection Matrix for customized orthographic view.
 
static Matrix CreateOrthographicOffCenter (Rectangle viewingVolume, float zNearPlane, float zFarPlane)
 Creates a new projection Matrix for customized orthographic view.
 
static void CreateOrthographicOffCenter (float left, float right, float bottom, float top, float zNearPlane, float zFarPlane, out Matrix result)
 Creates a new projection Matrix for customized orthographic view.
 
static Matrix CreatePerspective (float width, float height, float nearPlaneDistance, float farPlaneDistance)
 Creates a new projection Matrix for perspective view.
 
static void CreatePerspective (float width, float height, float nearPlaneDistance, float farPlaneDistance, out Matrix result)
 Creates a new projection Matrix for perspective view.
 
static Matrix CreatePerspectiveFieldOfView (float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance)
 Creates a new projection Matrix for perspective view with field of view.
 
static void CreatePerspectiveFieldOfView (float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance, out Matrix result)
 Creates a new projection Matrix for perspective view with field of view.
 
static Matrix CreatePerspectiveOffCenter (float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance)
 Creates a new projection Matrix for customized perspective view.
 
static Matrix CreatePerspectiveOffCenter (Rectangle viewingVolume, float nearPlaneDistance, float farPlaneDistance)
 Creates a new projection Matrix for customized perspective view.
 
static void CreatePerspectiveOffCenter (float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance, out Matrix result)
 Creates a new projection Matrix for customized perspective view.
 
static Matrix CreateRotationX (float radians)
 Creates a new rotation Matrix around X axis.
 
static void CreateRotationX (float radians, out Matrix result)
 Creates a new rotation Matrix around X axis.
 
static Matrix CreateRotationY (float radians)
 Creates a new rotation Matrix around Y axis.
 
static void CreateRotationY (float radians, out Matrix result)
 Creates a new rotation Matrix around Y axis.
 
static Matrix CreateRotationZ (float radians)
 Creates a new rotation Matrix around Z axis.
 
static void CreateRotationZ (float radians, out Matrix result)
 Creates a new rotation Matrix around Z axis.
 
static Matrix CreateScale (float scale)
 Creates a new scaling Matrix.
 
static void CreateScale (float scale, out Matrix result)
 Creates a new scaling Matrix.
 
static Matrix CreateScale (float xScale, float yScale, float zScale)
 Creates a new scaling Matrix.
 
static void CreateScale (float xScale, float yScale, float zScale, out Matrix result)
 Creates a new scaling Matrix.
 
static Matrix CreateScale (Vector3 scales)
 Creates a new scaling Matrix.
 
static void CreateScale (ref Vector3 scales, out Matrix result)
 Creates a new scaling Matrix.
 
static Matrix CreateShadow (Vector3 lightDirection, Plane plane)
 Creates a new Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.
 
static void CreateShadow (ref Vector3 lightDirection, ref Plane plane, out Matrix result)
 Creates a new Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.
 
static Matrix CreateTranslation (float xPosition, float yPosition, float zPosition)
 Creates a new translation Matrix.
 
static void CreateTranslation (ref Vector3 position, out Matrix result)
 Creates a new translation Matrix.
 
static Matrix CreateTranslation (Vector3 position)
 Creates a new translation Matrix.
 
static void CreateTranslation (float xPosition, float yPosition, float zPosition, out Matrix result)
 Creates a new translation Matrix.
 
static Matrix CreateReflection (Plane value)
 Creates a new reflection Matrix.
 
static void CreateReflection (ref Plane value, out Matrix result)
 Creates a new reflection Matrix.
 
static Matrix CreateWorld (Vector3 position, Vector3 forward, Vector3 up)
 Creates a new world Matrix.
 
static void CreateWorld (ref Vector3 position, ref Vector3 forward, ref Vector3 up, out Matrix result)
 Creates a new world Matrix.
 
static Matrix Divide (Matrix matrix1, Matrix matrix2)
 Divides the elements of a Matrix by the elements of another matrix.
 
static void Divide (ref Matrix matrix1, ref Matrix matrix2, out Matrix result)
 Divides the elements of a Matrix by the elements of another matrix.
 
static Matrix Divide (Matrix matrix1, float divider)
 Divides the elements of a Matrix by a scalar.
 
static void Divide (ref Matrix matrix1, float divider, out Matrix result)
 Divides the elements of a Matrix by a scalar.
 
static Matrix Invert (Matrix matrix)
 Creates a new Matrix which contains inversion of the specified matrix.
 
static void Invert (ref Matrix matrix, out Matrix result)
 Creates a new Matrix which contains inversion of the specified matrix.
 
static Matrix Lerp (Matrix matrix1, Matrix matrix2, float amount)
 Creates a new Matrix that contains linear interpolation of the values in specified matrixes.
 
static void Lerp (ref Matrix matrix1, ref Matrix matrix2, float amount, out Matrix result)
 Creates a new Matrix that contains linear interpolation of the values in specified matrixes.
 
static Matrix Multiply (Matrix matrix1, Matrix matrix2)
 Creates a new Matrix that contains a multiplication of two matrix.
 
static void Multiply (ref Matrix matrix1, ref Matrix matrix2, out Matrix result)
 Creates a new Matrix that contains a multiplication of two matrix.
 
static Matrix Multiply (Matrix matrix1, float scaleFactor)
 Creates a new Matrix that contains a multiplication of Matrix and a scalar.
 
static void Multiply (ref Matrix matrix1, float scaleFactor, out Matrix result)
 Creates a new Matrix that contains a multiplication of Matrix and a scalar.
 
static float[] ToFloatArray (Matrix matrix)
 Copy the values of specified Matrix to the float array.
 
static Matrix Negate (Matrix matrix)
 Returns a matrix with the all values negated.
 
static void Negate (ref Matrix matrix, out Matrix result)
 Returns a matrix with the all values negated.
 
static Matrix operator+ (Matrix matrix1, Matrix matrix2)
 Adds two matrixes.
 
static Matrix operator/ (Matrix matrix1, Matrix matrix2)
 Divides the elements of a Matrix by the elements of another Matrix.
 
static Matrix operator/ (Matrix matrix, float divider)
 Divides the elements of a Matrix by a scalar.
 
static bool operator== (Matrix matrix1, Matrix matrix2)
 Compares whether two Matrix instances are equal without any tolerance.
 
static bool operator!= (Matrix matrix1, Matrix matrix2)
 Compares whether two Matrix instances are not equal without any tolerance.
 
static Matrix operator* (Matrix matrix1, Matrix matrix2)
 Multiplies two matrixes.
 
static Matrix operator* (Matrix matrix, float scaleFactor)
 Multiplies the elements of matrix by a scalar.
 
static Matrix operator- (Matrix matrix1, Matrix matrix2)
 Subtracts the values of one Matrix from another Matrix.
 
static Matrix operator- (Matrix matrix)
 Inverts values in the specified Matrix.
 
static Matrix Subtract (Matrix matrix1, Matrix matrix2)
 Creates a new Matrix that contains subtraction of one matrix from another.
 
static void Subtract (ref Matrix matrix1, ref Matrix matrix2, out Matrix result)
 Creates a new Matrix that contains subtraction of one matrix from another.
 
static Matrix Transpose (Matrix matrix)
 Swap the matrix rows and columns.
 
static void Transpose (ref Matrix matrix, out Matrix result)
 Swap the matrix rows and columns.
 

Public Attributes

float M11
 A first row and first column value.
 
float M12
 A first row and second column value.
 
float M13
 A first row and third column value.
 
float M14
 A first row and fourth column value.
 
float M21
 A second row and first column value.
 
float M22
 A second row and second column value.
 
float M23
 A second row and third column value.
 
float M24
 A second row and fourth column value.
 
float M31
 A third row and first column value.
 
float M32
 A third row and second column value.
 
float M33
 A third row and third column value.
 
float M34
 A third row and fourth column value.
 
float M41
 A fourth row and first column value.
 
float M42
 A fourth row and second column value.
 
float M43
 A fourth row and third column value.
 
float M44
 A fourth row and fourth column value.
 

Properties

float this[int index] [get, set]
 
float this[int row, int column] [get, set]
 
Vector3 Backward [get, set]
 The backward vector formed from the third row M31, M32, M33 elements.
 
Vector3 Down [get, set]
 The down vector formed from the second row -M21, -M22, -M23 elements.
 
Vector3 Forward [get, set]
 The forward vector formed from the third row -M31, -M32, -M33 elements.
 
static Matrix Identity [get]
 Returns the identity matrix.
 
Vector3 Left [get, set]
 The left vector formed from the first row -M11, -M12, -M13 elements.
 
Vector3 Right [get, set]
 The right vector formed from the first row M11, M12, M13 elements.
 
Vector3 Translation [get, set]
 Position stored in this matrix.
 
Vector3 Up [get, set]
 The upper vector formed from the second row M21, M22, M23 elements.
 
string DebugDisplayString [get]
 

Static Private Member Functions

static void FindDeterminants (ref Matrix matrix, out float major, out float minor1, out float minor2, out float minor3, out float minor4, out float minor5, out float minor6, out float minor7, out float minor8, out float minor9, out float minor10, out float minor11, out float minor12)
 Helper method for using the Laplace expansion theorem using two rows expansions to calculate major and minor determinants of a 4x4 matrix.
 

Static Private Attributes

static Matrix identity
 

Constructor & Destructor Documentation

◆ Matrix() [1/2]

Mathf.Matrix.Matrix ( float m11,
float m12,
float m13,
float m14,
float m21,
float m22,
float m23,
float m24,
float m31,
float m32,
float m33,
float m34,
float m41,
float m42,
float m43,
float m44 )
inline

Constructs a matrix.

Parameters
m11A first row and first column value.
m12A first row and second column value.
m13A first row and third column value.
m14A first row and fourth column value.
m21A second row and first column value.
m22A second row and second column value.
m23A second row and third column value.
m24A second row and fourth column value.
m31A third row and first column value.
m32A third row and second column value.
m33A third row and third column value.
m34A third row and fourth column value.
m41A fourth row and first column value.
m42A fourth row and second column value.
m43A fourth row and third column value.
m44A fourth row and fourth column value.

◆ Matrix() [2/2]

Mathf.Matrix.Matrix ( Vector4 row1,
Vector4 row2,
Vector4 row3,
Vector4 row4 )
inline

Constructs a matrix.

Parameters
row1A first row of the created matrix.
row2A second row of the created matrix.
row3A third row of the created matrix.
row4A fourth row of the created matrix.

Member Function Documentation

◆ Add() [1/2]

static Matrix Mathf.Matrix.Add ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Creates a new Matrix which contains sum of two matrixes.

Parameters
matrix1The first matrix to add.
matrix2The second matrix to add.
Returns
The result of the matrix addition.

◆ Add() [2/2]

static void Mathf.Matrix.Add ( ref Matrix matrix1,
ref Matrix matrix2,
out Matrix result )
inlinestatic

Creates a new Matrix which contains sum of two matrixes.

Parameters
matrix1The first matrix to add.
matrix2The second matrix to add.
resultThe result of the matrix addition as an output parameter.

◆ CreateBillboard() [1/2]

static void Mathf.Matrix.CreateBillboard ( ref Vector3 objectPosition,
ref Vector3 cameraPosition,
ref Vector3 cameraUpVector,
Vector3? cameraForwardVector,
out Matrix result )
inlinestatic

Creates a new Matrix for spherical billboarding that rotates around specified object position.

Parameters
objectPositionPosition of billboard object. It will rotate around that vector.
cameraPositionThe camera position.
cameraUpVectorThe camera up vector.
cameraForwardVectorOptional camera forward vector.
resultThe Matrix for spherical billboarding as an output parameter.

◆ CreateBillboard() [2/2]

static Matrix Mathf.Matrix.CreateBillboard ( Vector3 objectPosition,
Vector3 cameraPosition,
Vector3 cameraUpVector,
Nullable< Vector3 > cameraForwardVector )
inlinestatic

Creates a new Matrix for spherical billboarding that rotates around specified object position.

Parameters
objectPositionPosition of billboard object. It will rotate around that vector.
cameraPositionThe camera position.
cameraUpVectorThe camera up vector.
cameraForwardVectorOptional camera forward vector.
Returns
The Matrix for spherical billboarding.

◆ CreateConstrainedBillboard() [1/2]

static void Mathf.Matrix.CreateConstrainedBillboard ( ref Vector3 objectPosition,
ref Vector3 cameraPosition,
ref Vector3 rotateAxis,
Vector3? cameraForwardVector,
Vector3? objectForwardVector,
out Matrix result )
inlinestatic

Creates a new Matrix for cylindrical billboarding that rotates around specified axis.

Parameters
objectPositionObject position the billboard will rotate around.
cameraPositionCamera position.
rotateAxisAxis of billboard for rotation.
cameraForwardVectorOptional camera forward vector.
objectForwardVectorOptional object forward vector.
resultThe Matrix for cylindrical billboarding as an output parameter.

◆ CreateConstrainedBillboard() [2/2]

static Matrix Mathf.Matrix.CreateConstrainedBillboard ( Vector3 objectPosition,
Vector3 cameraPosition,
Vector3 rotateAxis,
Nullable< Vector3 > cameraForwardVector,
Nullable< Vector3 > objectForwardVector )
inlinestatic

Creates a new Matrix for cylindrical billboarding that rotates around specified axis.

Parameters
objectPositionObject position the billboard will rotate around.
cameraPositionCamera position.
rotateAxisAxis of billboard for rotation.
cameraForwardVectorOptional camera forward vector.
objectForwardVectorOptional object forward vector.
Returns
The Matrix for cylindrical billboarding.

◆ CreateFromAxisAngle() [1/2]

static void Mathf.Matrix.CreateFromAxisAngle ( ref Vector3 axis,
float angle,
out Matrix result )
inlinestatic

Creates a new Matrix which contains the rotation moment around specified axis.

Parameters
axisThe axis of rotation.
angleThe angle of rotation in radians.
resultThe rotation Matrix as an output parameter.

◆ CreateFromAxisAngle() [2/2]

static Matrix Mathf.Matrix.CreateFromAxisAngle ( Vector3 axis,
float angle )
inlinestatic

Creates a new Matrix which contains the rotation moment around specified axis.

Parameters
axisThe axis of rotation.
angleThe angle of rotation in radians.
Returns
The rotation Matrix.

◆ CreateFromQuaternion() [1/2]

static Matrix Mathf.Matrix.CreateFromQuaternion ( Quaternion quaternion)
inlinestatic

Creates a new rotation Matrix from a Quaternion.

Parameters
quaternionQuaternion of rotation moment.
Returns
The rotation Matrix.

◆ CreateFromQuaternion() [2/2]

static void Mathf.Matrix.CreateFromQuaternion ( ref Quaternion quaternion,
out Matrix result )
inlinestatic

Creates a new rotation Matrix from a Quaternion.

Parameters
quaternionQuaternion of rotation moment.
resultThe rotation Matrix as an output parameter.

◆ CreateFromYawPitchRoll() [1/2]

static Matrix Mathf.Matrix.CreateFromYawPitchRoll ( float yaw,
float pitch,
float roll )
inlinestatic

Creates a new rotation Matrix from the specified yaw, pitch and roll values.

Parameters
yawThe yaw rotation value in radians.
pitchThe pitch rotation value in radians.
rollThe roll rotation value in radians.
Returns
The rotation Matrix.

For more information about yaw, pitch and roll visit http://en.wikipedia.org/wiki/Euler_angles.

◆ CreateFromYawPitchRoll() [2/2]

static void Mathf.Matrix.CreateFromYawPitchRoll ( float yaw,
float pitch,
float roll,
out Matrix result )
inlinestatic

Creates a new rotation Matrix from the specified yaw, pitch and roll values.

Parameters
yawThe yaw rotation value in radians.
pitchThe pitch rotation value in radians.
rollThe roll rotation value in radians.
resultThe rotation Matrix as an output parameter.

For more information about yaw, pitch and roll visit http://en.wikipedia.org/wiki/Euler_angles.

◆ CreateLookAt() [1/2]

static void Mathf.Matrix.CreateLookAt ( ref Vector3 cameraPosition,
ref Vector3 cameraTarget,
ref Vector3 cameraUpVector,
out Matrix result )
inlinestatic

Creates a new viewing Matrix.

Parameters
cameraPositionPosition of the camera.
cameraTargetLookup vector of the camera.
cameraUpVectorThe direction of the upper edge of the camera.
resultThe viewing Matrix as an output parameter.

◆ CreateLookAt() [2/2]

static Matrix Mathf.Matrix.CreateLookAt ( Vector3 cameraPosition,
Vector3 cameraTarget,
Vector3 cameraUpVector )
inlinestatic

Creates a new viewing Matrix.

Parameters
cameraPositionPosition of the camera.
cameraTargetLookup vector of the camera.
cameraUpVectorThe direction of the upper edge of the camera.
Returns
The viewing Matrix.

◆ CreateOrthographic() [1/2]

static Matrix Mathf.Matrix.CreateOrthographic ( float width,
float height,
float zNearPlane,
float zFarPlane )
inlinestatic

Creates a new projection Matrix for orthographic view.

Parameters
widthWidth of the viewing volume.
heightHeight of the viewing volume.
zNearPlaneDepth of the near plane.
zFarPlaneDepth of the far plane.
Returns
The new projection Matrix for orthographic view.

◆ CreateOrthographic() [2/2]

static void Mathf.Matrix.CreateOrthographic ( float width,
float height,
float zNearPlane,
float zFarPlane,
out Matrix result )
inlinestatic

Creates a new projection Matrix for orthographic view.

Parameters
widthWidth of the viewing volume.
heightHeight of the viewing volume.
zNearPlaneDepth of the near plane.
zFarPlaneDepth of the far plane.
resultThe new projection Matrix for orthographic view as an output parameter.

◆ CreateOrthographicOffCenter() [1/3]

static Matrix Mathf.Matrix.CreateOrthographicOffCenter ( float left,
float right,
float bottom,
float top,
float zNearPlane,
float zFarPlane )
inlinestatic

Creates a new projection Matrix for customized orthographic view.

Parameters
leftLower x-value at the near plane.
rightUpper x-value at the near plane.
bottomLower y-coordinate at the near plane.
topUpper y-value at the near plane.
zNearPlaneDepth of the near plane.
zFarPlaneDepth of the far plane.
Returns
The new projection Matrix for customized orthographic view.

◆ CreateOrthographicOffCenter() [2/3]

static void Mathf.Matrix.CreateOrthographicOffCenter ( float left,
float right,
float bottom,
float top,
float zNearPlane,
float zFarPlane,
out Matrix result )
inlinestatic

Creates a new projection Matrix for customized orthographic view.

Parameters
leftLower x-value at the near plane.
rightUpper x-value at the near plane.
bottomLower y-coordinate at the near plane.
topUpper y-value at the near plane.
zNearPlaneDepth of the near plane.
zFarPlaneDepth of the far plane.
resultThe new projection Matrix for customized orthographic view as an output parameter.

◆ CreateOrthographicOffCenter() [3/3]

static Matrix Mathf.Matrix.CreateOrthographicOffCenter ( Rectangle viewingVolume,
float zNearPlane,
float zFarPlane )
inlinestatic

Creates a new projection Matrix for customized orthographic view.

Parameters
viewingVolumeThe viewing volume.
zNearPlaneDepth of the near plane.
zFarPlaneDepth of the far plane.
Returns
The new projection Matrix for customized orthographic view.

◆ CreatePerspective() [1/2]

static Matrix Mathf.Matrix.CreatePerspective ( float width,
float height,
float nearPlaneDistance,
float farPlaneDistance )
inlinestatic

Creates a new projection Matrix for perspective view.

Parameters
widthWidth of the viewing volume.
heightHeight of the viewing volume.
nearPlaneDistanceDistance to the near plane.
farPlaneDistanceDistance to the far plane.
Returns
The new projection Matrix for perspective view.

◆ CreatePerspective() [2/2]

static void Mathf.Matrix.CreatePerspective ( float width,
float height,
float nearPlaneDistance,
float farPlaneDistance,
out Matrix result )
inlinestatic

Creates a new projection Matrix for perspective view.

Parameters
widthWidth of the viewing volume.
heightHeight of the viewing volume.
nearPlaneDistanceDistance to the near plane.
farPlaneDistanceDistance to the far plane.
resultThe new projection Matrix for perspective view as an output parameter.

◆ CreatePerspectiveFieldOfView() [1/2]

static Matrix Mathf.Matrix.CreatePerspectiveFieldOfView ( float fieldOfView,
float aspectRatio,
float nearPlaneDistance,
float farPlaneDistance )
inlinestatic

Creates a new projection Matrix for perspective view with field of view.

Parameters
fieldOfViewField of view in the y direction in radians.
aspectRatioWidth divided by height of the viewing volume.
nearPlaneDistanceDistance to the near plane.
farPlaneDistanceDistance to the far plane.
Returns
The new projection Matrix for perspective view with FOV.

◆ CreatePerspectiveFieldOfView() [2/2]

static void Mathf.Matrix.CreatePerspectiveFieldOfView ( float fieldOfView,
float aspectRatio,
float nearPlaneDistance,
float farPlaneDistance,
out Matrix result )
inlinestatic

Creates a new projection Matrix for perspective view with field of view.

Parameters
fieldOfViewField of view in the y direction in radians.
aspectRatioWidth divided by height of the viewing volume.
nearPlaneDistanceDistance of the near plane.
farPlaneDistanceDistance of the far plane.
resultThe new projection Matrix for perspective view with FOV as an output parameter.

◆ CreatePerspectiveOffCenter() [1/3]

static Matrix Mathf.Matrix.CreatePerspectiveOffCenter ( float left,
float right,
float bottom,
float top,
float nearPlaneDistance,
float farPlaneDistance )
inlinestatic

Creates a new projection Matrix for customized perspective view.

Parameters
leftLower x-value at the near plane.
rightUpper x-value at the near plane.
bottomLower y-coordinate at the near plane.
topUpper y-value at the near plane.
nearPlaneDistanceDistance to the near plane.
farPlaneDistanceDistance to the far plane.
Returns
The new Matrix for customized perspective view.

◆ CreatePerspectiveOffCenter() [2/3]

static void Mathf.Matrix.CreatePerspectiveOffCenter ( float left,
float right,
float bottom,
float top,
float nearPlaneDistance,
float farPlaneDistance,
out Matrix result )
inlinestatic

Creates a new projection Matrix for customized perspective view.

Parameters
leftLower x-value at the near plane.
rightUpper x-value at the near plane.
bottomLower y-coordinate at the near plane.
topUpper y-value at the near plane.
nearPlaneDistanceDistance to the near plane.
farPlaneDistanceDistance to the far plane.
resultThe new Matrix for customized perspective view as an output parameter.

◆ CreatePerspectiveOffCenter() [3/3]

static Matrix Mathf.Matrix.CreatePerspectiveOffCenter ( Rectangle viewingVolume,
float nearPlaneDistance,
float farPlaneDistance )
inlinestatic

Creates a new projection Matrix for customized perspective view.

Parameters
viewingVolumeThe viewing volume.
nearPlaneDistanceDistance to the near plane.
farPlaneDistanceDistance to the far plane.
Returns
The new Matrix for customized perspective view.

◆ CreateReflection() [1/2]

static Matrix Mathf.Matrix.CreateReflection ( Plane value)
inlinestatic

Creates a new reflection Matrix.

Parameters
valueThe plane that used for reflection calculation.
Returns
The reflection Matrix.

◆ CreateReflection() [2/2]

static void Mathf.Matrix.CreateReflection ( ref Plane value,
out Matrix result )
inlinestatic

Creates a new reflection Matrix.

Parameters
valueThe plane that used for reflection calculation.
resultThe reflection Matrix as an output parameter.

◆ CreateRotationX() [1/2]

static Matrix Mathf.Matrix.CreateRotationX ( float radians)
inlinestatic

Creates a new rotation Matrix around X axis.

Parameters
radiansAngle in radians.
Returns
The rotation Matrix around X axis.

◆ CreateRotationX() [2/2]

static void Mathf.Matrix.CreateRotationX ( float radians,
out Matrix result )
inlinestatic

Creates a new rotation Matrix around X axis.

Parameters
radiansAngle in radians.
resultThe rotation Matrix around X axis as an output parameter.

◆ CreateRotationY() [1/2]

static Matrix Mathf.Matrix.CreateRotationY ( float radians)
inlinestatic

Creates a new rotation Matrix around Y axis.

Parameters
radiansAngle in radians.
Returns
The rotation Matrix around Y axis.

◆ CreateRotationY() [2/2]

static void Mathf.Matrix.CreateRotationY ( float radians,
out Matrix result )
inlinestatic

Creates a new rotation Matrix around Y axis.

Parameters
radiansAngle in radians.
resultThe rotation Matrix around Y axis as an output parameter.

◆ CreateRotationZ() [1/2]

static Matrix Mathf.Matrix.CreateRotationZ ( float radians)
inlinestatic

Creates a new rotation Matrix around Z axis.

Parameters
radiansAngle in radians.
Returns
The rotation Matrix around Z axis.

◆ CreateRotationZ() [2/2]

static void Mathf.Matrix.CreateRotationZ ( float radians,
out Matrix result )
inlinestatic

Creates a new rotation Matrix around Z axis.

Parameters
radiansAngle in radians.
resultThe rotation Matrix around Z axis as an output parameter.

◆ CreateScale() [1/6]

static Matrix Mathf.Matrix.CreateScale ( float scale)
inlinestatic

Creates a new scaling Matrix.

Parameters
scaleScale value for all three axises.
Returns
The scaling Matrix.

◆ CreateScale() [2/6]

static void Mathf.Matrix.CreateScale ( float scale,
out Matrix result )
inlinestatic

Creates a new scaling Matrix.

Parameters
scaleScale value for all three axises.
resultThe scaling Matrix as an output parameter.

◆ CreateScale() [3/6]

static Matrix Mathf.Matrix.CreateScale ( float xScale,
float yScale,
float zScale )
inlinestatic

Creates a new scaling Matrix.

Parameters
xScaleScale value for X axis.
yScaleScale value for Y axis.
zScaleScale value for Z axis.
Returns
The scaling Matrix.

◆ CreateScale() [4/6]

static void Mathf.Matrix.CreateScale ( float xScale,
float yScale,
float zScale,
out Matrix result )
inlinestatic

Creates a new scaling Matrix.

Parameters
xScaleScale value for X axis.
yScaleScale value for Y axis.
zScaleScale value for Z axis.
resultThe scaling Matrix as an output parameter.

◆ CreateScale() [5/6]

static void Mathf.Matrix.CreateScale ( ref Vector3 scales,
out Matrix result )
inlinestatic

Creates a new scaling Matrix.

Parameters
scalesVector3 representing x,y and z scale values.
resultThe scaling Matrix as an output parameter.

◆ CreateScale() [6/6]

static Matrix Mathf.Matrix.CreateScale ( Vector3 scales)
inlinestatic

Creates a new scaling Matrix.

Parameters
scalesVector3 representing x,y and z scale values.
Returns
The scaling Matrix.

◆ CreateShadow() [1/2]

static void Mathf.Matrix.CreateShadow ( ref Vector3 lightDirection,
ref Plane plane,
out Matrix result )
inlinestatic

Creates a new Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.

Parameters
lightDirectionA vector specifying the direction from which the light that will cast the shadow is coming.
planeThe plane onto which the new matrix should flatten geometry so as to cast a shadow.
resultA Matrix that can be used to flatten geometry onto the specified plane from the specified direction as an output parameter.

◆ CreateShadow() [2/2]

static Matrix Mathf.Matrix.CreateShadow ( Vector3 lightDirection,
Plane plane )
inlinestatic

Creates a new Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.

Parameters
lightDirectionA vector specifying the direction from which the light that will cast the shadow is coming.
planeThe plane onto which the new matrix should flatten geometry so as to cast a shadow.
Returns
A Matrix that can be used to flatten geometry onto the specified plane from the specified direction.

◆ CreateTranslation() [1/4]

static Matrix Mathf.Matrix.CreateTranslation ( float xPosition,
float yPosition,
float zPosition )
inlinestatic

Creates a new translation Matrix.

Parameters
xPositionX coordinate of translation.
yPositionY coordinate of translation.
zPositionZ coordinate of translation.
Returns
The translation Matrix.

◆ CreateTranslation() [2/4]

static void Mathf.Matrix.CreateTranslation ( float xPosition,
float yPosition,
float zPosition,
out Matrix result )
inlinestatic

Creates a new translation Matrix.

Parameters
xPositionX coordinate of translation.
yPositionY coordinate of translation.
zPositionZ coordinate of translation.
resultThe translation Matrix as an output parameter.

◆ CreateTranslation() [3/4]

static void Mathf.Matrix.CreateTranslation ( ref Vector3 position,
out Matrix result )
inlinestatic

Creates a new translation Matrix.

Parameters
positionX,Y and Z coordinates of translation.
resultThe translation Matrix as an output parameter.

◆ CreateTranslation() [4/4]

static Matrix Mathf.Matrix.CreateTranslation ( Vector3 position)
inlinestatic

Creates a new translation Matrix.

Parameters
positionX,Y and Z coordinates of translation.
Returns
The translation Matrix.

◆ CreateWorld() [1/2]

static void Mathf.Matrix.CreateWorld ( ref Vector3 position,
ref Vector3 forward,
ref Vector3 up,
out Matrix result )
inlinestatic

Creates a new world Matrix.

Parameters
positionThe position vector.
forwardThe forward direction vector.
upThe upward direction vector. Usually Vector3.Up.
resultThe world Matrix as an output parameter.

◆ CreateWorld() [2/2]

static Matrix Mathf.Matrix.CreateWorld ( Vector3 position,
Vector3 forward,
Vector3 up )
inlinestatic

Creates a new world Matrix.

Parameters
positionThe position vector.
forwardThe forward direction vector.
upThe upward direction vector. Usually Vector3.Up.
Returns
The world Matrix.

◆ Decompose()

bool Mathf.Matrix.Decompose ( out Vector3 scale,
out Quaternion rotation,
out Vector3 translation )
inline

Decomposes this matrix to translation, rotation and scale elements.

Returns true if matrix can be decomposed; false otherwise.

Parameters
scaleScale vector as an output parameter.
rotationRotation quaternion as an output parameter.
translationTranslation vector as an output parameter.
Returns
true if matrix can be decomposed; false otherwise.

◆ Determinant()

float Mathf.Matrix.Determinant ( )
inline

Returns a determinant of this Matrix.

Returns
Determinant of this Matrix

See more about determinant here - http://en.wikipedia.org/wiki/Determinant.

◆ Divide() [1/4]

static Matrix Mathf.Matrix.Divide ( Matrix matrix1,
float divider )
inlinestatic

Divides the elements of a Matrix by a scalar.

Parameters
matrix1Source Matrix.
dividerDivisor scalar.
Returns
The result of dividing a matrix by a scalar.

◆ Divide() [2/4]

static Matrix Mathf.Matrix.Divide ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Divides the elements of a Matrix by the elements of another matrix.

Parameters
matrix1Source Matrix.
matrix2Divisor Matrix.
Returns
The result of dividing the matrix.

◆ Divide() [3/4]

static void Mathf.Matrix.Divide ( ref Matrix matrix1,
float divider,
out Matrix result )
inlinestatic

Divides the elements of a Matrix by a scalar.

Parameters
matrix1Source Matrix.
dividerDivisor scalar.
resultThe result of dividing a matrix by a scalar as an output parameter.

◆ Divide() [4/4]

static void Mathf.Matrix.Divide ( ref Matrix matrix1,
ref Matrix matrix2,
out Matrix result )
inlinestatic

Divides the elements of a Matrix by the elements of another matrix.

Parameters
matrix1Source Matrix.
matrix2Divisor Matrix.
resultThe result of dividing the matrix as an output parameter.

◆ Equals() [1/2]

bool Mathf.Matrix.Equals ( Matrix other)
inline

Compares whether current instance is equal to specified Matrix without any tolerance.

Parameters
otherThe Matrix to compare.
Returns
true if the instances are equal; false otherwise.

◆ Equals() [2/2]

override bool Mathf.Matrix.Equals ( object obj)
inline

Compares whether current instance is equal to specified Object without any tolerance.

Parameters
objThe Object to compare.
Returns
true if the instances are equal; false otherwise.

◆ FindDeterminants()

static void Mathf.Matrix.FindDeterminants ( ref Matrix matrix,
out float major,
out float minor1,
out float minor2,
out float minor3,
out float minor4,
out float minor5,
out float minor6,
out float minor7,
out float minor8,
out float minor9,
out float minor10,
out float minor11,
out float minor12 )
inlinestaticprivate

Helper method for using the Laplace expansion theorem using two rows expansions to calculate major and minor determinants of a 4x4 matrix.

This method is used for inverting a matrix.

◆ GetHashCode()

override int Mathf.Matrix.GetHashCode ( )
inline

Gets the hash code of this Matrix.

Returns
Hash code of this Matrix.

◆ Invert() [1/2]

static Matrix Mathf.Matrix.Invert ( Matrix matrix)
inlinestatic

Creates a new Matrix which contains inversion of the specified matrix.

Parameters
matrixSource Matrix.
Returns
The inverted matrix.

◆ Invert() [2/2]

static void Mathf.Matrix.Invert ( ref Matrix matrix,
out Matrix result )
inlinestatic

Creates a new Matrix which contains inversion of the specified matrix.

Parameters
matrixSource Matrix.
resultThe inverted matrix as output parameter.

◆ Lerp() [1/2]

static Matrix Mathf.Matrix.Lerp ( Matrix matrix1,
Matrix matrix2,
float amount )
inlinestatic

Creates a new Matrix that contains linear interpolation of the values in specified matrixes.

Parameters
matrix1The first Matrix.
matrix2The second Vector2.
amountWeighting value(between 0.0 and 1.0).
Returns
>The result of linear interpolation of the specified matrixes.

◆ Lerp() [2/2]

static void Mathf.Matrix.Lerp ( ref Matrix matrix1,
ref Matrix matrix2,
float amount,
out Matrix result )
inlinestatic

Creates a new Matrix that contains linear interpolation of the values in specified matrixes.

Parameters
matrix1The first Matrix.
matrix2The second Vector2.
amountWeighting value(between 0.0 and 1.0).
resultThe result of linear interpolation of the specified matrixes as an output parameter.

◆ Multiply() [1/4]

static Matrix Mathf.Matrix.Multiply ( Matrix matrix1,
float scaleFactor )
inlinestatic

Creates a new Matrix that contains a multiplication of Matrix and a scalar.

Parameters
matrix1Source Matrix.
scaleFactorScalar value.
Returns
Result of the matrix multiplication with a scalar.

◆ Multiply() [2/4]

static Matrix Mathf.Matrix.Multiply ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Creates a new Matrix that contains a multiplication of two matrix.

Parameters
matrix1Source Matrix.
matrix2Source Matrix.
Returns
Result of the matrix multiplication.

◆ Multiply() [3/4]

static void Mathf.Matrix.Multiply ( ref Matrix matrix1,
float scaleFactor,
out Matrix result )
inlinestatic

Creates a new Matrix that contains a multiplication of Matrix and a scalar.

Parameters
matrix1Source Matrix.
scaleFactorScalar value.
resultResult of the matrix multiplication with a scalar as an output parameter.

◆ Multiply() [4/4]

static void Mathf.Matrix.Multiply ( ref Matrix matrix1,
ref Matrix matrix2,
out Matrix result )
inlinestatic

Creates a new Matrix that contains a multiplication of two matrix.

Parameters
matrix1Source Matrix.
matrix2Source Matrix.
resultResult of the matrix multiplication as an output parameter.

◆ Negate() [1/2]

static Matrix Mathf.Matrix.Negate ( Matrix matrix)
inlinestatic

Returns a matrix with the all values negated.

Parameters
matrixSource Matrix.
Returns
Result of the matrix negation.

◆ Negate() [2/2]

static void Mathf.Matrix.Negate ( ref Matrix matrix,
out Matrix result )
inlinestatic

Returns a matrix with the all values negated.

Parameters
matrixSource Matrix.
resultResult of the matrix negation as an output parameter.

◆ operator!=()

static bool Mathf.Matrix.operator!= ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Compares whether two Matrix instances are not equal without any tolerance.

Parameters
matrix1Source Matrix on the left of the not equal sign.
matrix2Source Matrix on the right of the not equal sign.
Returns
true if the instances are not equal; false otherwise.

◆ operator*() [1/2]

static Matrix Mathf.Matrix.operator* ( Matrix matrix,
float scaleFactor )
inlinestatic

Multiplies the elements of matrix by a scalar.

Parameters
matrixSource Matrix on the left of the mul sign.
scaleFactorScalar value on the right of the mul sign.
Returns
Result of the matrix multiplication with a scalar.

◆ operator*() [2/2]

static Matrix Mathf.Matrix.operator* ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Multiplies two matrixes.

Parameters
matrix1Source Matrix on the left of the mul sign.
matrix2Source Matrix on the right of the mul sign.
Returns
Result of the matrix multiplication.

Using matrix multiplication algorithm - see http://en.wikipedia.org/wiki/Matrix_multiplication.

◆ operator+()

static Matrix Mathf.Matrix.operator+ ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Adds two matrixes.

Parameters
matrix1Source Matrix on the left of the add sign.
matrix2Source Matrix on the right of the add sign.
Returns
Sum of the matrixes.

◆ operator-() [1/2]

static Matrix Mathf.Matrix.operator- ( Matrix matrix)
inlinestatic

Inverts values in the specified Matrix.

Parameters
matrixSource Matrix on the right of the sub sign.
Returns
Result of the inversion.

◆ operator-() [2/2]

static Matrix Mathf.Matrix.operator- ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Subtracts the values of one Matrix from another Matrix.

Parameters
matrix1Source Matrix on the left of the sub sign.
matrix2Source Matrix on the right of the sub sign.
Returns
Result of the matrix subtraction.

◆ operator/() [1/2]

static Matrix Mathf.Matrix.operator/ ( Matrix matrix,
float divider )
inlinestatic

Divides the elements of a Matrix by a scalar.

Parameters
matrixSource Matrix on the left of the div sign.
dividerDivisor scalar on the right of the div sign.
Returns
The result of dividing a matrix by a scalar.

◆ operator/() [2/2]

static Matrix Mathf.Matrix.operator/ ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Divides the elements of a Matrix by the elements of another Matrix.

Parameters
matrix1Source Matrix on the left of the div sign.
matrix2Divisor Matrix on the right of the div sign.
Returns
The result of dividing the matrixes.

◆ operator==()

static bool Mathf.Matrix.operator== ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Compares whether two Matrix instances are equal without any tolerance.

Parameters
matrix1Source Matrix on the left of the equal sign.
matrix2Source Matrix on the right of the equal sign.
Returns
true if the instances are equal; false otherwise.

◆ Subtract() [1/2]

static Matrix Mathf.Matrix.Subtract ( Matrix matrix1,
Matrix matrix2 )
inlinestatic

Creates a new Matrix that contains subtraction of one matrix from another.

Parameters
matrix1The first Matrix.
matrix2The second Matrix.
Returns
The result of the matrix subtraction.

◆ Subtract() [2/2]

static void Mathf.Matrix.Subtract ( ref Matrix matrix1,
ref Matrix matrix2,
out Matrix result )
inlinestatic

Creates a new Matrix that contains subtraction of one matrix from another.

Parameters
matrix1The first Matrix.
matrix2The second Matrix.
resultThe result of the matrix subtraction as an output parameter.

◆ ToFloatArray()

static float[] Mathf.Matrix.ToFloatArray ( Matrix matrix)
inlinestatic

Copy the values of specified Matrix to the float array.

Parameters
matrixThe source Matrix.
Returns
The array which matrix values will be stored.

Required for OpenGL 2.0 projection matrix stuff.

◆ ToString()

override string Mathf.Matrix.ToString ( )
inline

Returns a String representation of this Matrix in the format: {M11:[M11] M12:[M12] M13:[M13] M14:[M14]} {M21:[M21] M12:[M22] M13:[M23] M14:[M24]} {M31:[M31] M32:[M32] M33:[M33] M34:[M34]} {M41:[M41] M42:[M42] M43:[M43] M44:[M44]}.

Returns
A String representation of this Matrix.

◆ Transpose() [1/2]

static Matrix Mathf.Matrix.Transpose ( Matrix matrix)
inlinestatic

Swap the matrix rows and columns.

Parameters
matrixThe matrix for transposing operation.
Returns
The new Matrix which contains the transposing result.

◆ Transpose() [2/2]

static void Mathf.Matrix.Transpose ( ref Matrix matrix,
out Matrix result )
inlinestatic

Swap the matrix rows and columns.

Parameters
matrixThe matrix for transposing operation.
resultThe new Matrix which contains the transposing result as an output parameter.

Member Data Documentation

◆ identity

Matrix Mathf.Matrix.identity
staticprivate
Initial value:
= new Matrix(1f, 0f, 0f, 0f,
0f, 1f, 0f, 0f,
0f, 0f, 1f, 0f,
0f, 0f, 0f, 1f)
Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
Constructs a matrix.
Definition Matrix.cs:41

◆ M11

float Mathf.Matrix.M11

A first row and first column value.

◆ M12

float Mathf.Matrix.M12

A first row and second column value.

◆ M13

float Mathf.Matrix.M13

A first row and third column value.

◆ M14

float Mathf.Matrix.M14

A first row and fourth column value.

◆ M21

float Mathf.Matrix.M21

A second row and first column value.

◆ M22

float Mathf.Matrix.M22

A second row and second column value.

◆ M23

float Mathf.Matrix.M23

A second row and third column value.

◆ M24

float Mathf.Matrix.M24

A second row and fourth column value.

◆ M31

float Mathf.Matrix.M31

A third row and first column value.

◆ M32

float Mathf.Matrix.M32

A third row and second column value.

◆ M33

float Mathf.Matrix.M33

A third row and third column value.

◆ M34

float Mathf.Matrix.M34

A third row and fourth column value.

◆ M41

float Mathf.Matrix.M41

A fourth row and first column value.

◆ M42

float Mathf.Matrix.M42

A fourth row and second column value.

◆ M43

float Mathf.Matrix.M43

A fourth row and third column value.

◆ M44

float Mathf.Matrix.M44

A fourth row and fourth column value.

Property Documentation

◆ Backward

Vector3 Mathf.Matrix.Backward
getset

The backward vector formed from the third row M31, M32, M33 elements.

◆ DebugDisplayString

string Mathf.Matrix.DebugDisplayString
getpackage

◆ Down

Vector3 Mathf.Matrix.Down
getset

The down vector formed from the second row -M21, -M22, -M23 elements.

◆ Forward

Vector3 Mathf.Matrix.Forward
getset

The forward vector formed from the third row -M31, -M32, -M33 elements.

◆ Identity

Matrix Mathf.Matrix.Identity
staticget

Returns the identity matrix.

◆ Left

Vector3 Mathf.Matrix.Left
getset

The left vector formed from the first row -M11, -M12, -M13 elements.

◆ Right

Vector3 Mathf.Matrix.Right
getset

The right vector formed from the first row M11, M12, M13 elements.

◆ this[int index]

float Mathf.Matrix.this[int index]
getset

◆ this[int row, int column]

float Mathf.Matrix.this[int row, int column]
getset

◆ Translation

Vector3 Mathf.Matrix.Translation
getset

Position stored in this matrix.

◆ Up

Vector3 Mathf.Matrix.Up
getset

The upper vector formed from the second row M21, M22, M23 elements.


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