• Articles
  • Api Documentation
Show / Hide Table of Contents
  • Vim.Math3d
    • AABox
    • AABox2D
    • AABox4D
    • AngularMotion
    • AxisAngle
    • Byte2
    • Byte3
    • Byte4
    • ColorHDR
    • ColorRGB
    • ColorRGBA
    • Complex
    • Constants
    • ContainmentType
    • CylindricalCoordinate
    • DAABox
    • DAABox2D
    • DAABox4D
    • DInterval
    • DPlane
    • DQuaternion
    • DRay
    • DSphere
    • DVector2
    • DVector3
    • DVector4
    • Euler
    • GeoCoordinate
    • Hash
    • HorizontalCoordinate
    • IMappable<TContainer, TPart>
    • Int2
    • Int3
    • Int4
    • Interval
    • IPoints
    • IPoints2D
    • ITransformable3D<TSelf>
    • Line
    • Line2D
    • LinearMotion
    • LinqUtil
    • LogPolarCoordinate
    • MathOps
    • Matrix4x4
    • Motion
    • MovementExtensions
    • Plane
    • PlaneIntersectionType
    • PolarCoordinate
    • Quad
    • Quad2D
    • Quaternion
    • Ray
    • Sphere
    • SphericalCoordinate
    • StatelessRandom
    • Stats<T>
    • Transform
    • Transformable3D
    • Triangle
    • Triangle2D
    • Vector2
    • Vector3
    • Vector4

Struct Matrix4x4

A structure encapsulating a 4x4 matrix.

Implements
System.IEquatable<Matrix4x4>
ITransformable3D<Matrix4x4>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Vim.Math3d
Assembly: Vim.Math3D.dll
[DataContract]
public struct Matrix4x4 : IEquatable<Matrix4x4>, ITransformable3D<Matrix4x4>

Constructors

View Source

Matrix4x4(Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single)

Constructs a Matrix4x4 from the given components.

public Matrix4x4(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)

Fields

View Source

Identity

Returns the multiplicative identity matrix.

public static Matrix4x4 Identity
View Source

M11

Value at row 1, column 1 of the matrix.

[DataMember]
public float M11
View Source

M12

Value at row 1, column 2 of the matrix.

[DataMember]
public float M12
View Source

M13

Value at row 1, column 3 of the matrix.

[DataMember]
public float M13
View Source

M14

Value at row 1, column 4 of the matrix.

[DataMember]
public float M14
View Source

M21

Value at row 2, column 1 of the matrix.

[DataMember]
public float M21
View Source

M22

Value at row 2, column 2 of the matrix.

[DataMember]
public float M22
View Source

M23

Value at row 2, column 3 of the matrix.

[DataMember]
public float M23
View Source

M24

Value at row 2, column 4 of the matrix.

[DataMember]
public float M24
View Source

M31

Value at row 3, column 1 of the matrix.

[DataMember]
public float M31
View Source

M32

Value at row 3, column 2 of the matrix.

[DataMember]
public float M32
View Source

M33

Value at row 3, column 3 of the matrix.

[DataMember]
public float M33
View Source

M34

Value at row 3, column 4 of the matrix.

[DataMember]
public float M34
View Source

M41

Value at row 4, column 1 of the matrix.

[DataMember]
public float M41
View Source

M42

Value at row 4, column 2 of the matrix.

[DataMember]
public float M42
View Source

M43

Value at row 4, column 3 of the matrix.

[DataMember]
public float M43
View Source

M44

Value at row 4, column 4 of the matrix.

[DataMember]
public float M44

Properties

View Source

Col0

public readonly Vector3 Col0 { get; }
View Source

Col1

public readonly Vector3 Col1 { get; }
View Source

Col2

public readonly Vector3 Col2 { get; }
View Source

Col3

public readonly Vector3 Col3 { get; }
View Source

IsIdentity

Returns whether the matrix is the identity matrix.

public readonly bool IsIdentity { get; }
View Source

IsReflection

Returns true if the 3x3 rotation determinant of the matrix is less than 0. This assumes the matrix represents an affine transform.

public readonly bool IsReflection { get; }
View Source

Row0

public readonly Vector3 Row0 { get; }
View Source

Row1

public readonly Vector3 Row1 { get; }
View Source

Row2

public readonly Vector3 Row2 { get; }
View Source

Row3

public readonly Vector3 Row3 { get; }
View Source

Translation

Gets the translation component of this matrix.

public readonly Vector3 Translation { get; }

Methods

View Source

Add(Matrix4x4, Matrix4x4)

Adds two matrices together.

public static Matrix4x4 Add(Matrix4x4 value1, Matrix4x4 value2)
View Source

CreateBillboard(Vector3, Vector3, Vector3, Vector3)

Creates a spherical billboard that rotates around a specified object position.

public static Matrix4x4 CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector)
View Source

CreateConstrainedBillboard(Vector3, Vector3, Vector3, Vector3, Vector3)

Creates a cylindrical billboard that rotates around a specified axis.

public static Matrix4x4 CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 rotateAxis, Vector3 cameraForwardVector, Vector3 objectForwardVector)
View Source

CreateFromAxisAngle(Vector3, Single)

Creates a matrix that rotates around an arbitrary vector.

public static Matrix4x4 CreateFromAxisAngle(Vector3 axis, float angle)
View Source

CreateFromQuaternion(Quaternion)

Creates a rotation matrix from the given Quaternion rotation value.

public static Matrix4x4 CreateFromQuaternion(Quaternion quaternion)
View Source

CreateFromRows(Vector3, Vector3, Vector3)

public static Matrix4x4 CreateFromRows(Vector3 row0, Vector3 row1, Vector3 row2)
View Source

CreateFromRows(Vector3, Vector3, Vector3, Vector3)

public static Matrix4x4 CreateFromRows(Vector3 row0, Vector3 row1, Vector3 row2, Vector3 row3)
View Source

CreateFromRows(Vector4, Vector4, Vector4)

public static Matrix4x4 CreateFromRows(Vector4 row0, Vector4 row1, Vector4 row2)
View Source

CreateFromRows(Vector4, Vector4, Vector4, Vector4)

public static Matrix4x4 CreateFromRows(Vector4 row0, Vector4 row1, Vector4 row2, Vector4 row3)
View Source

CreateFromYawPitchRoll(Single, Single, Single)

Creates a rotation matrix from the specified yaw, pitch, and roll.

public static Matrix4x4 CreateFromYawPitchRoll(float yaw, float pitch, float roll)
View Source

CreateLookAt(Vector3, Vector3, Vector3)

Creates a view matrix.

public static Matrix4x4 CreateLookAt(Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector)
View Source

CreateOrthographic(Single, Single, Single, Single)

Creates an orthographic perspective matrix from the given view volume dimensions.

public static Matrix4x4 CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane)
View Source

CreateOrthographicOffCenter(Single, Single, Single, Single, Single, Single)

Builds a customized, orthographic projection matrix.

public static Matrix4x4 CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane)
View Source

CreatePerspective(Single, Single, Single, Single)

Creates a perspective projection matrix from the given view volume dimensions.

public static Matrix4x4 CreatePerspective(float width, float height, float nearPlaneDistance, float farPlaneDistance)
View Source

CreatePerspectiveFieldOfView(Single, Single, Single, Single)

Creates a perspective projection matrix based on a field of view, aspect ratio, and near and far view plane distances.

public static Matrix4x4 CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance)
View Source

CreatePerspectiveOffCenter(Single, Single, Single, Single, Single, Single)

Creates a customized, perspective projection matrix.

public static Matrix4x4 CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance)
View Source

CreateReflection(Plane)

Creates a Matrix that reflects the coordinate system about a specified Plane.

public static Matrix4x4 CreateReflection(Plane value)
View Source

CreateRotation(Quaternion)

Creates a rotation matrix from the given Quaternion rotation value.

public static Matrix4x4 CreateRotation(Quaternion quaternion)
View Source

CreateRotationX(Single)

Creates a matrix for rotating points around the X-axis.

public static Matrix4x4 CreateRotationX(float radians)
View Source

CreateRotationX(Single, Vector3)

Creates a matrix for rotating points around the X-axis, from a center point.

public static Matrix4x4 CreateRotationX(float radians, Vector3 centerPoint)
View Source

CreateRotationY(Single)

Creates a matrix for rotating points around the Y-axis.

public static Matrix4x4 CreateRotationY(float radians)
View Source

CreateRotationY(Single, Vector3)

Creates a matrix for rotating points around the Y-axis, from a center point.

public static Matrix4x4 CreateRotationY(float radians, Vector3 centerPoint)
View Source

CreateRotationZ(Single)

Creates a matrix for rotating points around the Z-axis.

public static Matrix4x4 CreateRotationZ(float radians)
View Source

CreateRotationZ(Single, Vector3)

Creates a matrix for rotating points around the Z-axis, from a center point.

public static Matrix4x4 CreateRotationZ(float radians, Vector3 centerPoint)
View Source

CreateScale(Single)

Creates a uniform scaling matrix that scales equally on each axis.

public static Matrix4x4 CreateScale(float scale)
View Source

CreateScale(Single, Single, Single)

Creates a scaling matrix.

public static Matrix4x4 CreateScale(float xScale, float yScale, float zScale)
View Source

CreateScale(Single, Single, Single, Vector3)

Creates a scaling matrix with a center point.

public static Matrix4x4 CreateScale(float xScale, float yScale, float zScale, Vector3 centerPoint)
View Source

CreateScale(Single, Vector3)

Creates a uniform scaling matrix that scales equally on each axis with a center point.

public static Matrix4x4 CreateScale(float scale, Vector3 centerPoint)
View Source

CreateScale(Vector3)

Creates a scaling matrix.

public static Matrix4x4 CreateScale(Vector3 scales)
View Source

CreateScale(Vector3, Vector3)

Creates a scaling matrix with a center point.

public static Matrix4x4 CreateScale(Vector3 scales, Vector3 centerPoint)
View Source

CreateShadow(Vector3, Plane)

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

public static Matrix4x4 CreateShadow(Vector3 lightDirection, Plane plane)
View Source

CreateTranslation(Single, Single, Single)

Creates a translation matrix.

public static Matrix4x4 CreateTranslation(float x, float y, float z)
View Source

CreateTranslation(Vector3)

Creates a translation matrix.

public static Matrix4x4 CreateTranslation(Vector3 position)
View Source

CreateTRS(Vector3, Quaternion, Vector3)

public static Matrix4x4 CreateTRS(Vector3 translation, Quaternion rotation, Vector3 scale)
View Source

CreateWorld(Vector3, Vector3, Vector3)

Creates a world matrix with the specified parameters.

public static Matrix4x4 CreateWorld(Vector3 position, Vector3 forward, Vector3 up)
View Source

Decompose(Matrix4x4, out Vector3, out Quaternion, out Vector3)

Attempts to extract the scale, translation, and rotation components from the given scale/rotation/translation matrix. If successful, the out parameters will contained the extracted values. https://referencesource.microsoft.com/#System.Numerics/System/Numerics/Matrix4x4.cs

public static bool Decompose(Matrix4x4 matrix, out Vector3 scale, out Quaternion rotation, out Vector3 translation)
View Source

Decompose(out Vector3, out Quaternion, out Vector3)

Attempts to extract the scale, translation, and rotation components from the given scale/rotation/translation matrix. If successful, the out parameters will contained the extracted values. https://referencesource.microsoft.com/#System.Numerics/System/Numerics/Matrix4x4.cs

public bool Decompose(out Vector3 scale, out Quaternion rotation, out Vector3 translation)
View Source

Equals(Object)

Returns a boolean indicating whether the given Object is equal to this matrix instance.

public override bool Equals(object obj)
Overrides
System.ValueType.Equals(System.Object)
View Source

Equals(Matrix4x4)

Returns a boolean indicating whether this matrix instance is equal to the other given matrix.

public bool Equals(Matrix4x4 other)
View Source

ExtractDirectScale()

public Vector3 ExtractDirectScale()
View Source

Get3x3RotationDeterminant()

Calculates the determinant of the 3x3 rotational component of the matrix.

public float Get3x3RotationDeterminant()
View Source

GetCol(Int32)

public Vector3 GetCol(int col)
View Source

GetDeterminant()

Calculates the determinant of the matrix.

public float GetDeterminant()
View Source

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()
Overrides
System.ValueType.GetHashCode()
View Source

GetRow(Int32)

public Vector3 GetRow(int row)
View Source

Invert(Matrix4x4, out Matrix4x4)

Attempts to calculate the inverse of the given matrix. If successful, result will contain the inverted matrix.

public static bool Invert(Matrix4x4 matrix, out Matrix4x4 result)
View Source

Lerp(Matrix4x4, Matrix4x4, Single)

Linearly interpolates between the corresponding values of two matrices.

public static Matrix4x4 Lerp(Matrix4x4 matrix1, Matrix4x4 matrix2, float amount)
View Source

Multiply(Matrix4x4, Single)

Multiplies a matrix by a scalar value.

public static Matrix4x4 Multiply(Matrix4x4 value1, float value2)
View Source

Multiply(Matrix4x4, Matrix4x4)

Multiplies a matrix by another matrix.

public static Matrix4x4 Multiply(Matrix4x4 value1, Matrix4x4 value2)
View Source

Negate(Matrix4x4)

Returns a new matrix with the negated elements of the given matrix.

public static Matrix4x4 Negate(Matrix4x4 value)
View Source

ScaleTranslation(Single)

public Matrix4x4 ScaleTranslation(float amount)
View Source

SetTranslation(Vector3)

Sets the translation component of this matrix, returning a new Matrix

public Matrix4x4 SetTranslation(Vector3 v)
View Source

Subtract(Matrix4x4, Matrix4x4)

Subtracts the second matrix from the first.

public static Matrix4x4 Subtract(Matrix4x4 value1, Matrix4x4 value2)
View Source

ToString()

Returns a String representing this matrix instance.

public override string ToString()
Overrides
System.ValueType.ToString()
View Source

Transform(Matrix4x4)

public Matrix4x4 Transform(Matrix4x4 mat)
View Source

Transform(Matrix4x4, Quaternion)

Transforms the given matrix by applying the given Quaternion rotation.

public static Matrix4x4 Transform(Matrix4x4 value, Quaternion rotation)
View Source

Transpose()

Transposes the rows and columns of a matrix.

public Matrix4x4 Transpose()
View Source

Transpose(Matrix4x4)

Transposes the rows and columns of a matrix.

public static Matrix4x4 Transpose(Matrix4x4 matrix)

Operators

View Source

Addition(Matrix4x4, Matrix4x4)

Adds two matrices together.

public static Matrix4x4 operator +(Matrix4x4 value1, Matrix4x4 value2)
View Source

Equality(Matrix4x4, Matrix4x4)

Returns a boolean indicating whether the given two matrices are equal.

public static bool operator ==(Matrix4x4 value1, Matrix4x4 value2)
View Source

Inequality(Matrix4x4, Matrix4x4)

Returns a boolean indicating whether the given two matrices are not equal.

public static bool operator !=(Matrix4x4 value1, Matrix4x4 value2)
View Source

Multiply(Matrix4x4, Single)

Multiplies a matrix by a scalar value.

public static Matrix4x4 operator *(Matrix4x4 value1, float value2)
View Source

Multiply(Matrix4x4, Matrix4x4)

Multiplies a matrix by another matrix.

public static Matrix4x4 operator *(Matrix4x4 value1, Matrix4x4 value2)
View Source

Subtraction(Matrix4x4, Matrix4x4)

Subtracts the second matrix from the first.

public static Matrix4x4 operator -(Matrix4x4 value1, Matrix4x4 value2)
View Source

UnaryNegation(Matrix4x4)

Returns a new matrix with the negated elements of the given matrix.

public static Matrix4x4 operator -(Matrix4x4 value)

Implements

System.IEquatable<T>
ITransformable3D<TSelf>

Extension Methods

Transformable3D.Transform<T>(ITransformable3D<T>, Matrix4x4[])
Transformable3D.Translate<T>(ITransformable3D<T>, Vector3)
Transformable3D.Translate<T>(ITransformable3D<T>, Single, Single, Single)
Transformable3D.Rotate<T>(ITransformable3D<T>, Quaternion)
Transformable3D.Scale<T>(ITransformable3D<T>, Single)
Transformable3D.Scale<T>(ITransformable3D<T>, Vector3)
Transformable3D.Scale<T>(ITransformable3D<T>, Single, Single, Single)
Transformable3D.ScaleX<T>(ITransformable3D<T>, Single)
Transformable3D.ScaleY<T>(ITransformable3D<T>, Single)
Transformable3D.ScaleZ<T>(ITransformable3D<T>, Single)
Transformable3D.LookAt<T>(ITransformable3D<T>, Vector3, Vector3, Vector3)
Transformable3D.RotateAround<T>(ITransformable3D<T>, Vector3, Single)
Transformable3D.Rotate<T>(ITransformable3D<T>, Single, Single, Single)
Transformable3D.Reflect<T>(ITransformable3D<T>, Plane)
Transformable3D.RotateX<T>(ITransformable3D<T>, Single)
Transformable3D.RotateY<T>(ITransformable3D<T>, Single)
Transformable3D.RotateZ<T>(ITransformable3D<T>, Single)
Transformable3D.TranslateRotateScale<T>(ITransformable3D<T>, Vector3, Quaternion, Vector3)
MathOps.ToFloats(Matrix4x4)
MathOps.RayFromProjectionMatrix(Matrix4x4, Vector2)
MathOps.Inverse(Matrix4x4)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright VIM 2021, Generated by DocFX