Nebula
|
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 |
|
inline |
Constructs a matrix.
m11 | A first row and first column value. |
m12 | A first row and second column value. |
m13 | A first row and third column value. |
m14 | A first row and fourth column value. |
m21 | A second row and first column value. |
m22 | A second row and second column value. |
m23 | A second row and third column value. |
m24 | A second row and fourth column value. |
m31 | A third row and first column value. |
m32 | A third row and second column value. |
m33 | A third row and third column value. |
m34 | A third row and fourth column value. |
m41 | A fourth row and first column value. |
m42 | A fourth row and second column value. |
m43 | A fourth row and third column value. |
m44 | A fourth row and fourth column value. |
Constructs a matrix.
row1 | A first row of the created matrix. |
row2 | A second row of the created matrix. |
row3 | A third row of the created matrix. |
row4 | A fourth row of the created matrix. |
Creates a new Matrix which contains sum of two matrixes.
matrix1 | The first matrix to add. |
matrix2 | The second matrix to add. |
|
inlinestatic |
Creates a new Matrix which contains sum of two matrixes.
matrix1 | The first matrix to add. |
matrix2 | The second matrix to add. |
result | The result of the matrix addition as an output parameter. |
|
inlinestatic |
Creates a new Matrix for spherical billboarding that rotates around specified object position.
objectPosition | Position of billboard object. It will rotate around that vector. |
cameraPosition | The camera position. |
cameraUpVector | The camera up vector. |
cameraForwardVector | Optional camera forward vector. |
result | The Matrix for spherical billboarding as an output parameter. |
|
inlinestatic |
Creates a new Matrix for spherical billboarding that rotates around specified object position.
objectPosition | Position of billboard object. It will rotate around that vector. |
cameraPosition | The camera position. |
cameraUpVector | The camera up vector. |
cameraForwardVector | Optional camera forward vector. |
|
inlinestatic |
Creates a new Matrix for cylindrical billboarding that rotates around specified axis.
objectPosition | Object position the billboard will rotate around. |
cameraPosition | Camera position. |
rotateAxis | Axis of billboard for rotation. |
cameraForwardVector | Optional camera forward vector. |
objectForwardVector | Optional object forward vector. |
result | The Matrix for cylindrical billboarding as an output parameter. |
|
inlinestatic |
Creates a new Matrix for cylindrical billboarding that rotates around specified axis.
objectPosition | Object position the billboard will rotate around. |
cameraPosition | Camera position. |
rotateAxis | Axis of billboard for rotation. |
cameraForwardVector | Optional camera forward vector. |
objectForwardVector | Optional object forward vector. |
|
inlinestatic |
Creates a new rotation Matrix from a Quaternion.
quaternion | Quaternion of rotation moment. |
|
inlinestatic |
Creates a new rotation Matrix from a Quaternion.
quaternion | Quaternion of rotation moment. |
result | The rotation Matrix as an output parameter. |
|
inlinestatic |
Creates a new rotation Matrix from the specified yaw, pitch and roll values.
yaw | The yaw rotation value in radians. |
pitch | The pitch rotation value in radians. |
roll | The roll rotation value in radians. |
For more information about yaw, pitch and roll visit http://en.wikipedia.org/wiki/Euler_angles.
|
inlinestatic |
Creates a new rotation Matrix from the specified yaw, pitch and roll values.
yaw | The yaw rotation value in radians. |
pitch | The pitch rotation value in radians. |
roll | The roll rotation value in radians. |
result | The rotation Matrix as an output parameter. |
For more information about yaw, pitch and roll visit http://en.wikipedia.org/wiki/Euler_angles.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Creates a new projection Matrix for customized orthographic view.
left | Lower x-value at the near plane. |
right | Upper x-value at the near plane. |
bottom | Lower y-coordinate at the near plane. |
top | Upper y-value at the near plane. |
zNearPlane | Depth of the near plane. |
zFarPlane | Depth of the far plane. |
|
inlinestatic |
Creates a new projection Matrix for customized orthographic view.
left | Lower x-value at the near plane. |
right | Upper x-value at the near plane. |
bottom | Lower y-coordinate at the near plane. |
top | Upper y-value at the near plane. |
zNearPlane | Depth of the near plane. |
zFarPlane | Depth of the far plane. |
result | The new projection Matrix for customized orthographic view as an output parameter. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Creates a new projection Matrix for perspective view with field of view.
fieldOfView | Field of view in the y direction in radians. |
aspectRatio | Width divided by height of the viewing volume. |
nearPlaneDistance | Distance to the near plane. |
farPlaneDistance | Distance to the far plane. |
|
inlinestatic |
Creates a new projection Matrix for perspective view with field of view.
fieldOfView | Field of view in the y direction in radians. |
aspectRatio | Width divided by height of the viewing volume. |
nearPlaneDistance | Distance of the near plane. |
farPlaneDistance | Distance of the far plane. |
result | The new projection Matrix for perspective view with FOV as an output parameter. |
|
inlinestatic |
Creates a new projection Matrix for customized perspective view.
left | Lower x-value at the near plane. |
right | Upper x-value at the near plane. |
bottom | Lower y-coordinate at the near plane. |
top | Upper y-value at the near plane. |
nearPlaneDistance | Distance to the near plane. |
farPlaneDistance | Distance to the far plane. |
|
inlinestatic |
Creates a new projection Matrix for customized perspective view.
left | Lower x-value at the near plane. |
right | Upper x-value at the near plane. |
bottom | Lower y-coordinate at the near plane. |
top | Upper y-value at the near plane. |
nearPlaneDistance | Distance to the near plane. |
farPlaneDistance | Distance to the far plane. |
result | The new Matrix for customized perspective view as an output parameter. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Creates a new Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.
lightDirection | A vector specifying the direction from which the light that will cast the shadow is coming. |
plane | The plane onto which the new matrix should flatten geometry so as to cast a shadow. |
result | A Matrix that can be used to flatten geometry onto the specified plane from the specified direction as an output parameter. |
Creates a new Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.
lightDirection | A vector specifying the direction from which the light that will cast the shadow is coming. |
plane | The plane onto which the new matrix should flatten geometry so as to cast a shadow. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Creates a new world Matrix.
position | The position vector. |
forward | The forward direction vector. |
up | The upward direction vector. Usually Vector3.Up. |
result | The world Matrix as an output parameter. |
|
inlinestatic |
Creates a new world Matrix.
position | The position vector. |
forward | The forward direction vector. |
up | The upward direction vector. Usually Vector3.Up. |
|
inline |
Decomposes this matrix to translation, rotation and scale elements.
Returns true
if matrix can be decomposed; false
otherwise.
scale | Scale vector as an output parameter. |
rotation | Rotation quaternion as an output parameter. |
translation | Translation vector as an output parameter. |
true
if matrix can be decomposed; false
otherwise.
|
inline |
Returns a determinant of this Matrix.
See more about determinant here - http://en.wikipedia.org/wiki/Determinant.
|
inline |
|
inline |
Compares whether current instance is equal to specified Object without any tolerance.
obj | The Object to compare. |
true
if the instances are equal; false
otherwise.
|
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.
|
inline |
Returns a matrix with the all values negated.
matrix | Source Matrix. |
Returns a matrix with the all values negated.
matrix | Source Matrix. |
result | Result of the matrix negation as an output parameter. |
Multiplies the elements of matrix by a scalar.
matrix | Source Matrix on the left of the mul sign. |
scaleFactor | Scalar value on the right of the mul sign. |
Multiplies two matrixes.
matrix1 | Source Matrix on the left of the mul sign. |
matrix2 | Source Matrix on the right of the mul sign. |
Using matrix multiplication algorithm - see http://en.wikipedia.org/wiki/Matrix_multiplication.
|
inlinestatic |
|
inline |
Swap the matrix rows and columns.
matrix | The matrix for transposing operation. |
Swap the matrix rows and columns.
matrix | The matrix for transposing operation. |
result | The new Matrix which contains the transposing result as an output parameter. |
|
staticprivate |
float Mathf.Matrix.M11 |
A first row and first column value.
float Mathf.Matrix.M12 |
A first row and second column value.
float Mathf.Matrix.M13 |
A first row and third column value.
float Mathf.Matrix.M14 |
A first row and fourth column value.
float Mathf.Matrix.M21 |
A second row and first column value.
float Mathf.Matrix.M22 |
A second row and second column value.
float Mathf.Matrix.M23 |
A second row and third column value.
float Mathf.Matrix.M24 |
A second row and fourth column value.
float Mathf.Matrix.M31 |
A third row and first column value.
float Mathf.Matrix.M32 |
A third row and second column value.
float Mathf.Matrix.M33 |
A third row and third column value.
float Mathf.Matrix.M34 |
A third row and fourth column value.
float Mathf.Matrix.M41 |
A fourth row and first column value.
float Mathf.Matrix.M42 |
A fourth row and second column value.
float Mathf.Matrix.M43 |
A fourth row and third column value.
float Mathf.Matrix.M44 |
A fourth row and fourth column value.
|
getset |
The backward vector formed from the third row M31, M32, M33 elements.
|
getpackage |
|
getset |
The down vector formed from the second row -M21, -M22, -M23 elements.
|
getset |
The forward vector formed from the third row -M31, -M32, -M33 elements.
|
staticget |
Returns the identity matrix.
|
getset |
The left vector formed from the first row -M11, -M12, -M13 elements.
|
getset |
The right vector formed from the first row M11, M12, M13 elements.
|
getset |
|
getset |
|
getset |
Position stored in this matrix.
|
getset |
The upper vector formed from the second row M21, M22, M23 elements.