Skip to content
This repository was archived by the owner on Dec 13, 2025. It is now read-only.

VRageMath.Matrix

Malware edited this page Dec 21, 2018 · 54 revisions

Index

Matrix Struct

Namespace: VRageMath
Assembly: VRage.Math.dll

Summary

Defines a matrix.

Fields

Member Description
float M11 Value at row 1 column 1 of the matrix.
float M12 Value at row 1 column 2 of the matrix.
float M13 Value at row 1 column 3 of the matrix.
float M14 Value at row 1 column 4 of the matrix.
float M21 Value at row 2 column 1 of the matrix.
float M22 Value at row 2 column 2 of the matrix.
float M23 Value at row 2 column 3 of the matrix.
float M24 Value at row 2 column 4 of the matrix.
float M31 Value at row 3 column 1 of the matrix.
float M32 Value at row 3 column 2 of the matrix.
float M33 Value at row 3 column 3 of the matrix.
float M34 Value at row 3 column 4 of the matrix.
float M41 Value at row 4 column 1 of the matrix.
float M42 Value at row 4 column 2 of the matrix.
float M43 Value at row 4 column 3 of the matrix.
float M44 Value at row 4 column 4 of the matrix.
static Matrix Identity
static Matrix Zero

Properties

Member Description
Vector3 Up Gets and sets the up vector of the Matrix.
Vector3 Down Gets and sets the down vector of the Matrix.
Vector3 Right Gets and sets the right vector of the Matrix.
Vector3 Col0
Vector3 Col1
Vector3 Col2
Vector3 Left Gets and sets the left vector of the Matrix.
Vector3 Forward Gets and sets the forward vector of the Matrix.
Vector3 Backward Gets and sets the backward vector of the Matrix.
Vector3 Scale
Vector3 Translation Gets and sets the translation vector of the Matrix.
float Item

Methods

Member Description
static void Subtract(ref Matrix matrix1, ref Matrix matrix2, ref Matrix result) Subtracts matrices.
static Matrix Multiply(Matrix matrix1, Matrix matrix2) Multiplies a matrix by another matrix.
static void Multiply(ref Matrix matrix1, ref Matrix matrix2, ref Matrix result) Multiplies a matrix by another matrix.
static void MultiplyRotation(ref Matrix matrix1, ref Matrix matrix2, ref Matrix result) Multiplies a matrix by another matrix, only rotation parts.
static Matrix Multiply(Matrix matrix1, float scaleFactor) Multiplies a matrix by a scalar value.
static void Multiply(ref Matrix matrix1, float scaleFactor, ref Matrix result) Multiplies a matrix by a scalar value.
static Matrix Divide(Matrix matrix1, Matrix matrix2) Divides the components of a matrix by the corresponding components of another matrix.
static void Divide(ref Matrix matrix1, ref Matrix matrix2, ref Matrix result) Divides the components of a matrix by the corresponding components of another matrix.
static Matrix Divide(Matrix matrix1, float divider) Divides the components of a matrix by a scalar.
static void Divide(ref Matrix matrix1, float divider, ref Matrix result) Divides the components of a matrix by a scalar.
Matrix GetOrientation() Gets the orientation.
void AssertIsValid()
bool IsValid()
bool IsNan()
bool IsRotation()
bool HasNoTranslationOrPerspective() Returns true if this matrix represents invertible (you can call Invert on it) linear (it does not contain translation or perspective transformation) transformation. Such matrix consist solely of rotations, shearing, mirroring and scaling. It can be orthogonalized to create an orthogonal rotation matrix.
static Matrix CreateFromDir(Vector3 dir)
static Matrix CreateFromDir(Vector3 dir, Vector3 suggestedUp)
static Matrix Normalize(Matrix matrix)
static Matrix Orthogonalize(Matrix rotationMatrix)
static Matrix Round(ref Matrix matrix)
static Matrix AlignRotationToAxes(ref Matrix toAlign, ref Matrix axisDefinitionMatrix)
static bool GetEulerAnglesXYZ(ref Matrix mat, ref Vector3 xyz)
static Matrix SwapYZCoordinates(Matrix m)
bool IsMirrored()
bool IsOrthogonal()
Vector3 GetDirectionVector(Direction direction)
void SetDirectionVector(Direction direction, Vector3 newValue)
Direction GetClosestDirection(Vector3 referenceVector)
Direction GetClosestDirection(ref Vector3 referenceVector)
static void Rescale(ref Matrix matrix, float scale) Same result as Matrix.CreateScale(scale) * matrix, but much faster
static void Rescale(ref Matrix matrix, ref Vector3 scale) Same result as Matrix.CreateScale(scale) * matrix, but much faster
static Matrix Rescale(Matrix matrix, float scale)
static Matrix Rescale(Matrix matrix, Vector3 scale)
static Matrix&nbsp;CreateBillboard(Vector3&nbsp;objectPosition,&nbsp;Vector3&nbsp;cameraPosition,&nbsp;Vector3&nbsp;cameraUpVector,&nbsp;Nullable<Vector3>&nbsp;cameraForwardVector) Creates a spherical billboard that rotates around a specified object position.
static void&nbsp;CreateBillboard(ref&nbsp;Vector3&nbsp;objectPosition,&nbsp;ref&nbsp;Vector3&nbsp;cameraPosition,&nbsp;ref&nbsp;Vector3&nbsp;cameraUpVector,&nbsp;Nullable<Vector3>&nbsp;cameraForwardVector,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a spherical billboard that rotates around a specified object position.
static Matrix&nbsp;CreateConstrainedBillboard(Vector3&nbsp;objectPosition,&nbsp;Vector3&nbsp;cameraPosition,&nbsp;Vector3&nbsp;rotateAxis,&nbsp;Nullable<Vector3>&nbsp;cameraForwardVector,&nbsp;Nullable<Vector3>&nbsp;objectForwardVector) Creates a cylindrical billboard that rotates around a specified axis.
static void&nbsp;CreateConstrainedBillboard(ref&nbsp;Vector3&nbsp;objectPosition,&nbsp;ref&nbsp;Vector3&nbsp;cameraPosition,&nbsp;ref&nbsp;Vector3&nbsp;rotateAxis,&nbsp;Nullable<Vector3>&nbsp;cameraForwardVector,&nbsp;Nullable<Vector3>&nbsp;objectForwardVector,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a cylindrical billboard that rotates around a specified axis.
static Matrix&nbsp;CreateTranslation(Vector3&nbsp;position) Creates a translation Matrix.
static void&nbsp;CreateTranslation(ref&nbsp;Vector3&nbsp;position,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a translation Matrix.
static Matrix&nbsp;CreateTranslation(float&nbsp;xPosition,&nbsp;float&nbsp;yPosition,&nbsp;float&nbsp;zPosition) Creates a translation Matrix.
static void&nbsp;CreateTranslation(float&nbsp;xPosition,&nbsp;float&nbsp;yPosition,&nbsp;float&nbsp;zPosition,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a translation Matrix.
static Matrix&nbsp;CreateScale(float&nbsp;xScale,&nbsp;float&nbsp;yScale,&nbsp;float&nbsp;zScale) Creates a scaling Matrix.
static void&nbsp;CreateScale(float&nbsp;xScale,&nbsp;float&nbsp;yScale,&nbsp;float&nbsp;zScale,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a scaling Matrix.
static Matrix&nbsp;CreateScale(Vector3&nbsp;scales) Creates a scaling Matrix.
static void&nbsp;CreateScale(ref&nbsp;Vector3&nbsp;scales,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a scaling Matrix.
static Matrix&nbsp;CreateScale(float&nbsp;scale) Creates a scaling Matrix.
static void&nbsp;CreateScale(float&nbsp;scale,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a scaling Matrix.
static Matrix&nbsp;CreateRotationX(float&nbsp;radians) Returns a matrix that can be used to rotate a set of vertices around the x-axis.
static void&nbsp;CreateRotationX(float&nbsp;radians,&nbsp;ref&nbsp;Matrix&nbsp;result) Populates data into a user-specified matrix that can be used to rotate a set of vertices around the x-axis.
static Matrix&nbsp;CreateRotationY(float&nbsp;radians) Returns a matrix that can be used to rotate a set of vertices around the y-axis.
static void&nbsp;CreateRotationY(float&nbsp;radians,&nbsp;ref&nbsp;Matrix&nbsp;result) Populates data into a user-specified matrix that can be used to rotate a set of vertices around the y-axis.
static Matrix&nbsp;CreateRotationZ(float&nbsp;radians) Returns a matrix that can be used to rotate a set of vertices around the z-axis.
static void&nbsp;CreateRotationZ(float&nbsp;radians,&nbsp;ref&nbsp;Matrix&nbsp;result) Populates data into a user-specified matrix that can be used to rotate a set of vertices around the z-axis.
static Matrix&nbsp;CreateFromAxisAngle(Vector3&nbsp;axis,&nbsp;float&nbsp;angle) Creates a new Matrix that rotates around an arbitrary vector.
static void&nbsp;CreateFromAxisAngle(ref&nbsp;Vector3&nbsp;axis,&nbsp;float&nbsp;angle,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a new Matrix that rotates around an arbitrary vector.
static void&nbsp;CreateRotationFromTwoVectors(ref&nbsp;Vector3&nbsp;fromVector,&nbsp;ref&nbsp;Vector3&nbsp;toVector,&nbsp;ref&nbsp;Matrix&nbsp;resultMatrix)
static Matrix&nbsp;CreatePerspectiveFieldOfView(float&nbsp;fieldOfView,&nbsp;float&nbsp;aspectRatio,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance) Builds a perspective projection matrix based on a field of view and returns by value.
static Matrix&nbsp;CreatePerspectiveFovRhComplementary(float&nbsp;fieldOfView,&nbsp;float&nbsp;aspectRatio,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance)
static Matrix&nbsp;CreatePerspectiveFovRhInfinite(float&nbsp;fieldOfView,&nbsp;float&nbsp;aspectRatio,&nbsp;float&nbsp;nearPlaneDistance)
static Matrix&nbsp;CreatePerspectiveFovRhInfiniteComplementary(float&nbsp;fieldOfView,&nbsp;float&nbsp;aspectRatio,&nbsp;float&nbsp;nearPlaneDistance)
static Matrix&nbsp;CreatePerspectiveFovRhInverse(float&nbsp;fieldOfView,&nbsp;float&nbsp;aspectRatio,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance)
static Matrix&nbsp;CreatePerspectiveFovRhInfiniteInverse(float&nbsp;fieldOfView,&nbsp;float&nbsp;aspectRatio,&nbsp;float&nbsp;nearPlaneDistance)
static Matrix&nbsp;CreatePerspectiveFovRhInfiniteComplementaryInverse(float&nbsp;fieldOfView,&nbsp;float&nbsp;aspectRatio,&nbsp;float&nbsp;nearPlaneDistance)
static Matrix&nbsp;CreateFromPerspectiveFieldOfView(ref&nbsp;Matrix&nbsp;proj,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance)
static void&nbsp;CreatePerspectiveFieldOfView(float&nbsp;fieldOfView,&nbsp;float&nbsp;aspectRatio,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance,&nbsp;ref&nbsp;Matrix&nbsp;result) Builds a perspective projection matrix based on a field of view and returns by reference.
static Matrix&nbsp;CreatePerspective(float&nbsp;width,&nbsp;float&nbsp;height,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance) Builds a perspective projection matrix and returns the result by value.
static void&nbsp;CreatePerspective(float&nbsp;width,&nbsp;float&nbsp;height,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance,&nbsp;ref&nbsp;Matrix&nbsp;result) Builds a perspective projection matrix and returns the result by reference.
static Matrix&nbsp;CreatePerspectiveOffCenter(float&nbsp;left,&nbsp;float&nbsp;right,&nbsp;float&nbsp;bottom,&nbsp;float&nbsp;top,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance) Builds a customized, perspective projection matrix.
static void&nbsp;CreatePerspectiveOffCenter(float&nbsp;left,&nbsp;float&nbsp;right,&nbsp;float&nbsp;bottom,&nbsp;float&nbsp;top,&nbsp;float&nbsp;nearPlaneDistance,&nbsp;float&nbsp;farPlaneDistance,&nbsp;ref&nbsp;Matrix&nbsp;result) Builds a customized, perspective projection matrix.
static Matrix&nbsp;CreateOrthographic(float&nbsp;width,&nbsp;float&nbsp;height,&nbsp;float&nbsp;zNearPlane,&nbsp;float&nbsp;zFarPlane) Builds an orthogonal projection matrix.
static void&nbsp;CreateOrthographic(float&nbsp;width,&nbsp;float&nbsp;height,&nbsp;float&nbsp;zNearPlane,&nbsp;float&nbsp;zFarPlane,&nbsp;ref&nbsp;Matrix&nbsp;result) Builds an orthogonal projection matrix.
static Matrix&nbsp;CreateOrthographicOffCenter(float&nbsp;left,&nbsp;float&nbsp;right,&nbsp;float&nbsp;bottom,&nbsp;float&nbsp;top,&nbsp;float&nbsp;zNearPlane,&nbsp;float&nbsp;zFarPlane) Builds a customized, orthogonal projection matrix.
static void&nbsp;CreateOrthographicOffCenter(float&nbsp;left,&nbsp;float&nbsp;right,&nbsp;float&nbsp;bottom,&nbsp;float&nbsp;top,&nbsp;float&nbsp;zNearPlane,&nbsp;float&nbsp;zFarPlane,&nbsp;ref&nbsp;Matrix&nbsp;result) Builds a customized, orthogonal projection matrix.
static Matrix&nbsp;CreateLookAt(Vector3&nbsp;cameraPosition,&nbsp;Vector3&nbsp;cameraTarget,&nbsp;Vector3&nbsp;cameraUpVector) Creates a view matrix.
static Matrix&nbsp;CreateLookAtInverse(Vector3&nbsp;cameraPosition,&nbsp;Vector3&nbsp;cameraTarget,&nbsp;Vector3&nbsp;cameraUpVector)
static void&nbsp;CreateLookAt(ref&nbsp;Vector3&nbsp;cameraPosition,&nbsp;ref&nbsp;Vector3&nbsp;cameraTarget,&nbsp;ref&nbsp;Vector3&nbsp;cameraUpVector,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a view matrix.
static Matrix&nbsp;CreateWorld(Vector3&nbsp;position)
static Matrix&nbsp;CreateWorld(Vector3&nbsp;position,&nbsp;Vector3&nbsp;forward,&nbsp;Vector3&nbsp;up) Creates a world matrix with the specified parameters.
static void&nbsp;CreateWorld(ref&nbsp;Vector3&nbsp;position,&nbsp;ref&nbsp;Vector3&nbsp;forward,&nbsp;ref&nbsp;Vector3&nbsp;up,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a world matrix with the specified parameters.
static Matrix&nbsp;CreateFromQuaternion(Quaternion&nbsp;quaternion) Creates a rotation Matrix from a Quaternion.
static void&nbsp;CreateFromQuaternion(ref&nbsp;Quaternion&nbsp;quaternion,&nbsp;ref&nbsp;Matrix&nbsp;result) Creates a rotation Matrix from a Quaternion.
static Matrix&nbsp;CreateFromYawPitchRoll(float&nbsp;yaw,&nbsp;float&nbsp;pitch,&nbsp;float&nbsp;roll) Creates a new rotation matrix from a specified yaw, pitch, and roll.
static void&nbsp;CreateFromYawPitchRoll(float&nbsp;yaw,&nbsp;float&nbsp;pitch,&nbsp;float&nbsp;roll,&nbsp;ref&nbsp;Matrix&nbsp;result) Fills in a rotation matrix from a specified yaw, pitch, and roll.
static Matrix&nbsp;CreateFromTransformScale(Quaternion&nbsp;orientation,&nbsp;Vector3&nbsp;position,&nbsp;Vector3&nbsp;scale)
static Matrix&nbsp;CreateShadow(Vector3&nbsp;lightDirection,&nbsp;Plane&nbsp;plane) Creates a Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.
static void&nbsp;CreateShadow(ref&nbsp;Vector3&nbsp;lightDirection,&nbsp;ref&nbsp;Plane&nbsp;plane,&nbsp;ref&nbsp;Matrix&nbsp;result) Fills in a Matrix to flatten geometry into a specified Plane as if casting a shadow from a specified light source.
static Matrix&nbsp;CreateReflection(Plane&nbsp;value) Creates a Matrix that reflects the coordinate system about a specified Plane.
static void&nbsp;CreateReflection(ref&nbsp;Plane&nbsp;value,&nbsp;ref&nbsp;Matrix&nbsp;result) Fills in an existing Matrix so that it reflects the coordinate system about a specified Plane.
static Matrix&nbsp;Transform(Matrix&nbsp;value,&nbsp;Quaternion&nbsp;rotation) Transforms a Matrix by applying a Quaternion rotation.
static void&nbsp;Transform(ref&nbsp;Matrix&nbsp;value,&nbsp;ref&nbsp;Quaternion&nbsp;rotation,&nbsp;ref&nbsp;Matrix&nbsp;result) Transforms a Matrix by applying a Quaternion rotation.
Vector4&nbsp;GetRow(int&nbsp;row)
void&nbsp;SetRow(int&nbsp;row,&nbsp;Vector4&nbsp;value)
string&nbsp;ToString() Retrieves a string representation of the current object.
bool&nbsp;Equals(Matrix&nbsp;other) Determines whether the specified Object is equal to the Matrix.
bool&nbsp;EqualsFast(ref&nbsp;Matrix&nbsp;other,&nbsp;float&nbsp;epsilon) Compares just position, forward and up
bool&nbsp;Equals(Object&nbsp;obj) Returns a value that indicates whether the current instance is equal to a specified object.
int&nbsp;GetHashCode() Gets the hash code of this object.
static Matrix&nbsp;Transpose(Matrix&nbsp;matrix) Transposes the rows and columns of a matrix.
static void&nbsp;Transpose(ref&nbsp;Matrix&nbsp;matrix,&nbsp;ref&nbsp;Matrix&nbsp;result) Transposes the rows and columns of a matrix.
void&nbsp;TransposeRotationInPlace() Transposes the rows and columns of a matrix that is assumed to be rotation only in place.
float&nbsp;Determinant() Calculates the determinant of the matrix.
static Matrix&nbsp;Invert(Matrix&nbsp;matrix) Calculates the inverse of a matrix.
static Matrix&nbsp;Invert(ref&nbsp;Matrix&nbsp;matrix)
static void&nbsp;Invert(ref&nbsp;Matrix&nbsp;matrix,&nbsp;ref&nbsp;Matrix&nbsp;result) Calculates the inverse of a matrix.
static Matrix&nbsp;Lerp(Matrix&nbsp;matrix1,&nbsp;Matrix&nbsp;matrix2,&nbsp;float&nbsp;amount) Linearly interpolates between the corresponding values of two matrices.
static void&nbsp;Lerp(ref&nbsp;Matrix&nbsp;matrix1,&nbsp;ref&nbsp;Matrix&nbsp;matrix2,&nbsp;float&nbsp;amount,&nbsp;ref&nbsp;Matrix&nbsp;result) Linearly interpolates between the corresponding values of two matrices.
static void&nbsp;Slerp(ref&nbsp;Matrix&nbsp;matrix1,&nbsp;ref&nbsp;Matrix&nbsp;matrix2,&nbsp;float&nbsp;amount,&nbsp;ref&nbsp;Matrix&nbsp;result) Performs spherical linear interpolation of position and rotation.
static void&nbsp;SlerpScale(ref&nbsp;Matrix&nbsp;matrix1,&nbsp;ref&nbsp;Matrix&nbsp;matrix2,&nbsp;float&nbsp;amount,&nbsp;ref&nbsp;Matrix&nbsp;result) Performs spherical linear interpolation of position and rotation and scale.
static void&nbsp;Slerp(Matrix&nbsp;matrix1,&nbsp;Matrix&nbsp;matrix2,&nbsp;float&nbsp;amount,&nbsp;ref&nbsp;Matrix&nbsp;result) Performs spherical linear interpolation of position and rotation.
static Matrix&nbsp;Slerp(Matrix&nbsp;matrix1,&nbsp;Matrix&nbsp;matrix2,&nbsp;float&nbsp;amount) Performs spherical linear interpolation of position and rotation.
static void&nbsp;SlerpScale(Matrix&nbsp;matrix1,&nbsp;Matrix&nbsp;matrix2,&nbsp;float&nbsp;amount,&nbsp;ref&nbsp;Matrix&nbsp;result) Performs spherical linear interpolation of position and rotation and scale.
static Matrix&nbsp;SlerpScale(Matrix&nbsp;matrix1,&nbsp;Matrix&nbsp;matrix2,&nbsp;float&nbsp;amount) Performs spherical linear interpolation of position and rotation and scale.
static Matrix&nbsp;Negate(Matrix&nbsp;matrix) Negates individual elements of a matrix.
static void&nbsp;Negate(ref&nbsp;Matrix&nbsp;matrix,&nbsp;ref&nbsp;Matrix&nbsp;result) Negates individual elements of a matrix.
static Matrix&nbsp;Add(Matrix&nbsp;matrix1,&nbsp;Matrix&nbsp;matrix2) Adds a matrix to another matrix.
static void&nbsp;Add(ref&nbsp;Matrix&nbsp;matrix1,&nbsp;ref&nbsp;Matrix&nbsp;matrix2,&nbsp;ref&nbsp;Matrix&nbsp;result) Adds a matrix to another matrix.
static Matrix&nbsp;Subtract(Matrix&nbsp;matrix1,&nbsp;Matrix&nbsp;matrix2) Subtracts matrices.

Clone this wiki locally