Show / Hide Table of Contents

    Struct Matrix4

    Represents a 4x4 matrix containing 3D rotation, scale, transform, and projection.

    Implements
    System.IEquatable<Matrix4>
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: AGS.API
    Assembly: AGS.API.dll
    Syntax
    public struct Matrix4 : IEquatable<Matrix4>

    Constructors

    | Improve this Doc View Source

    Matrix4(Matrix3)

    Constructs a new instance.

    Declaration
    public Matrix4(Matrix3 topLeft)
    Parameters
    Type Name Description
    Matrix3 topLeft

    The top left 3x3 of the matrix.

    | Improve this Doc View Source

    Matrix4(Vector4, Vector4, Vector4, Vector4)

    Constructs a new instance.

    Declaration
    public Matrix4(Vector4 row0, Vector4 row1, Vector4 row2, Vector4 row3)
    Parameters
    Type Name Description
    Vector4 row0

    Top row of the matrix.

    Vector4 row1

    Second row of the matrix.

    Vector4 row2

    Third row of the matrix.

    Vector4 row3

    Bottom row of the matrix.

    | Improve this Doc View Source

    Matrix4(Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single)

    Constructs a new instance.

    Declaration
    public Matrix4(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
    Parameters
    Type Name Description
    System.Single m00

    First item of the first row of the matrix.

    System.Single m01

    Second item of the first row of the matrix.

    System.Single m02

    Third item of the first row of the matrix.

    System.Single m03

    Fourth item of the first row of the matrix.

    System.Single m10

    First item of the second row of the matrix.

    System.Single m11

    Second item of the second row of the matrix.

    System.Single m12

    Third item of the second row of the matrix.

    System.Single m13

    Fourth item of the second row of the matrix.

    System.Single m20

    First item of the third row of the matrix.

    System.Single m21

    Second item of the third row of the matrix.

    System.Single m22

    Third item of the third row of the matrix.

    System.Single m23

    First item of the third row of the matrix.

    System.Single m30

    Fourth item of the fourth row of the matrix.

    System.Single m31

    Second item of the fourth row of the matrix.

    System.Single m32

    Third item of the fourth row of the matrix.

    System.Single m33

    Fourth item of the fourth row of the matrix.

    Fields

    | Improve this Doc View Source

    Identity

    The identity matrix.

    Declaration
    public static readonly Matrix4 Identity
    Field Value
    Type Description
    Matrix4
    | Improve this Doc View Source

    Row0

    Top row of the matrix.

    Declaration
    public Vector4 Row0
    Field Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Row1

    2nd row of the matrix.

    Declaration
    public Vector4 Row1
    Field Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Row2

    3rd row of the matrix.

    Declaration
    public Vector4 Row2
    Field Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Row3

    Bottom row of the matrix.

    Declaration
    public Vector4 Row3
    Field Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Zero

    The zero matrix.

    Declaration
    public static readonly Matrix4 Zero
    Field Value
    Type Description
    Matrix4

    Properties

    | Improve this Doc View Source

    Column0

    Gets the first column of this matrix.

    Declaration
    public Vector4 Column0 { get; set; }
    Property Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Column1

    Gets the second column of this matrix.

    Declaration
    public Vector4 Column1 { get; set; }
    Property Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Column2

    Gets the third column of this matrix.

    Declaration
    public Vector4 Column2 { get; set; }
    Property Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Column3

    Gets the fourth column of this matrix.

    Declaration
    public Vector4 Column3 { get; set; }
    Property Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Determinant

    Gets the determinant of this matrix.

    Declaration
    public float Determinant { get; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Diagonal

    Gets or sets the values along the main diagonal of the matrix.

    Declaration
    public Vector4 Diagonal { get; set; }
    Property Value
    Type Description
    Vector4
    | Improve this Doc View Source

    Item[Int32, Int32]

    Gets or sets the value at a specified row and column.

    Declaration
    public float this[int rowIndex, int columnIndex] { get; set; }
    Parameters
    Type Name Description
    System.Int32 rowIndex
    System.Int32 columnIndex
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M11

    Gets or sets the value at row 1, column 1 of this instance.

    Declaration
    public float M11 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M12

    Gets or sets the value at row 1, column 2 of this instance.

    Declaration
    public float M12 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M13

    Gets or sets the value at row 1, column 3 of this instance.

    Declaration
    public float M13 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M14

    Gets or sets the value at row 1, column 4 of this instance.

    Declaration
    public float M14 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M21

    Gets or sets the value at row 2, column 1 of this instance.

    Declaration
    public float M21 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M22

    Gets or sets the value at row 2, column 2 of this instance.

    Declaration
    public float M22 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M23

    Gets or sets the value at row 2, column 3 of this instance.

    Declaration
    public float M23 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M24

    Gets or sets the value at row 2, column 4 of this instance.

    Declaration
    public float M24 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M31

    Gets or sets the value at row 3, column 1 of this instance.

    Declaration
    public float M31 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M32

    Gets or sets the value at row 3, column 2 of this instance.

    Declaration
    public float M32 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M33

    Gets or sets the value at row 3, column 3 of this instance.

    Declaration
    public float M33 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M34

    Gets or sets the value at row 3, column 4 of this instance.

    Declaration
    public float M34 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M41

    Gets or sets the value at row 4, column 1 of this instance.

    Declaration
    public float M41 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M42

    Gets or sets the value at row 4, column 2 of this instance.

    Declaration
    public float M42 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M43

    Gets or sets the value at row 4, column 3 of this instance.

    Declaration
    public float M43 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    M44

    Gets or sets the value at row 4, column 4 of this instance.

    Declaration
    public float M44 { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Trace

    Gets the trace of the matrix, the sum of the values along the diagonal.

    Declaration
    public float Trace { get; }
    Property Value
    Type Description
    System.Single

    Methods

    | Improve this Doc View Source

    Add(Matrix4, Matrix4)

    Adds two instances.

    Declaration
    public static Matrix4 Add(Matrix4 left, Matrix4 right)
    Parameters
    Type Name Description
    Matrix4 left

    The left operand of the addition.

    Matrix4 right

    The right operand of the addition.

    Returns
    Type Description
    Matrix4

    A new instance that is the result of the addition.

    | Improve this Doc View Source

    Add(ref Matrix4, ref Matrix4, out Matrix4)

    Adds two instances.

    Declaration
    public static void Add(ref Matrix4 left, ref Matrix4 right, out Matrix4 result)
    Parameters
    Type Name Description
    Matrix4 left

    The left operand of the addition.

    Matrix4 right

    The right operand of the addition.

    Matrix4 result

    A new instance that is the result of the addition.

    | Improve this Doc View Source

    ClearProjection()

    Returns a copy of this Matrix4 without projection.

    Declaration
    public Matrix4 ClearProjection()
    Returns
    Type Description
    Matrix4
    | Improve this Doc View Source

    ClearRotation()

    Returns a copy of this Matrix4 without rotation.

    Declaration
    public Matrix4 ClearRotation()
    Returns
    Type Description
    Matrix4
    | Improve this Doc View Source

    ClearScale()

    Returns a copy of this Matrix4 without scale.

    Declaration
    public Matrix4 ClearScale()
    Returns
    Type Description
    Matrix4
    | Improve this Doc View Source

    ClearTranslation()

    Returns a copy of this Matrix4 without translation.

    Declaration
    public Matrix4 ClearTranslation()
    Returns
    Type Description
    Matrix4
    | Improve this Doc View Source

    CreateFromAxisAngle(Vector3, Single)

    Build a rotation matrix from the specified axis/angle rotation.

    Declaration
    public static Matrix4 CreateFromAxisAngle(Vector3 axis, float angle)
    Parameters
    Type Name Description
    Vector3 axis

    The axis to rotate about.

    System.Single angle

    Angle in radians to rotate counter-clockwise (looking in the direction of the given axis).

    Returns
    Type Description
    Matrix4

    A matrix instance.

    | Improve this Doc View Source

    CreateFromAxisAngle(Vector3, Single, out Matrix4)

    Build a rotation matrix from the specified axis/angle rotation.

    Declaration
    public static void CreateFromAxisAngle(Vector3 axis, float angle, out Matrix4 result)
    Parameters
    Type Name Description
    Vector3 axis

    The axis to rotate about.

    System.Single angle

    Angle in radians to rotate counter-clockwise (looking in the direction of the given axis).

    Matrix4 result

    A matrix instance.

    | Improve this Doc View Source

    CreateFromQuaternion(Quaternion)

    Builds a rotation matrix from a quaternion.

    Declaration
    public static Matrix4 CreateFromQuaternion(Quaternion q)
    Parameters
    Type Name Description
    Quaternion q

    The quaternion to rotate by.

    Returns
    Type Description
    Matrix4

    A matrix instance.

    | Improve this Doc View Source

    CreateFromQuaternion(ref Quaternion, out Matrix4)

    Builds a rotation matrix from a quaternion.

    Declaration
    public static void CreateFromQuaternion(ref Quaternion q, out Matrix4 result)
    Parameters
    Type Name Description
    Quaternion q

    The quaternion to rotate by.

    Matrix4 result

    A matrix instance.

    | Improve this Doc View Source

    CreateOrthographic(Single, Single, Single, Single)

    Creates an orthographic projection matrix.

    Declaration
    public static Matrix4 CreateOrthographic(float width, float height, float zNear, float zFar)
    Parameters
    Type Name Description
    System.Single width

    The width of the projection volume.

    System.Single height

    The height of the projection volume.

    System.Single zNear

    The near edge of the projection volume.

    System.Single zFar

    The far edge of the projection volume.

    Returns
    Type Description
    Matrix4
    | Improve this Doc View Source

    CreateOrthographic(Single, Single, Single, Single, out Matrix4)

    Creates an orthographic projection matrix.

    Declaration
    public static void CreateOrthographic(float width, float height, float zNear, float zFar, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single width

    The width of the projection volume.

    System.Single height

    The height of the projection volume.

    System.Single zNear

    The near edge of the projection volume.

    System.Single zFar

    The far edge of the projection volume.

    Matrix4 result

    The resulting Matrix4 instance.

    | Improve this Doc View Source

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

    Creates an orthographic projection matrix.

    Declaration
    public static Matrix4 CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNear, float zFar)
    Parameters
    Type Name Description
    System.Single left

    The left edge of the projection volume.

    System.Single right

    The right edge of the projection volume.

    System.Single bottom

    The bottom edge of the projection volume.

    System.Single top

    The top edge of the projection volume.

    System.Single zNear

    The near edge of the projection volume.

    System.Single zFar

    The far edge of the projection volume.

    Returns
    Type Description
    Matrix4

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateOrthographicOffCenter(Single, Single, Single, Single, Single, Single, out Matrix4)

    Creates an orthographic projection matrix.

    Declaration
    public static void CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNear, float zFar, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single left

    The left edge of the projection volume.

    System.Single right

    The right edge of the projection volume.

    System.Single bottom

    The bottom edge of the projection volume.

    System.Single top

    The top edge of the projection volume.

    System.Single zNear

    The near edge of the projection volume.

    System.Single zFar

    The far edge of the projection volume.

    Matrix4 result

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreatePerspectiveFieldOfView(Single, Single, Single, Single)

    Creates a perspective projection matrix.

    Declaration
    public static Matrix4 CreatePerspectiveFieldOfView(float fovy, float aspect, float zNear, float zFar)
    Parameters
    Type Name Description
    System.Single fovy

    Angle of the field of view in the y direction (in radians)

    System.Single aspect

    Aspect ratio of the view (width / height)

    System.Single zNear

    Distance to the near clip plane

    System.Single zFar

    Distance to the far clip plane

    Returns
    Type Description
    Matrix4

    A projection matrix that transforms camera space to raster space

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown under the following conditions:

    | Improve this Doc View Source

    CreatePerspectiveFieldOfView(Single, Single, Single, Single, out Matrix4)

    Creates a perspective projection matrix.

    Declaration
    public static void CreatePerspectiveFieldOfView(float fovy, float aspect, float zNear, float zFar, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single fovy

    Angle of the field of view in the y direction (in radians)

    System.Single aspect

    Aspect ratio of the view (width / height)

    System.Single zNear

    Distance to the near clip plane

    System.Single zFar

    Distance to the far clip plane

    Matrix4 result

    A projection matrix that transforms camera space to raster space

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown under the following conditions:

    | Improve this Doc View Source

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

    Creates an perspective projection matrix.

    Declaration
    public static Matrix4 CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float zNear, float zFar)
    Parameters
    Type Name Description
    System.Single left

    Left edge of the view frustum

    System.Single right

    Right edge of the view frustum

    System.Single bottom

    Bottom edge of the view frustum

    System.Single top

    Top edge of the view frustum

    System.Single zNear

    Distance to the near clip plane

    System.Single zFar

    Distance to the far clip plane

    Returns
    Type Description
    Matrix4

    A projection matrix that transforms camera space to raster space

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown under the following conditions:

    | Improve this Doc View Source

    CreatePerspectiveOffCenter(Single, Single, Single, Single, Single, Single, out Matrix4)

    Creates an perspective projection matrix.

    Declaration
    public static void CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float zNear, float zFar, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single left

    Left edge of the view frustum

    System.Single right

    Right edge of the view frustum

    System.Single bottom

    Bottom edge of the view frustum

    System.Single top

    Top edge of the view frustum

    System.Single zNear

    Distance to the near clip plane

    System.Single zFar

    Distance to the far clip plane

    Matrix4 result

    A projection matrix that transforms camera space to raster space

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown under the following conditions:

    | Improve this Doc View Source

    CreateRotationX(Single)

    Builds a rotation matrix for a rotation around the x-axis.

    Declaration
    public static Matrix4 CreateRotationX(float angle)
    Parameters
    Type Name Description
    System.Single angle

    The counter-clockwise angle in radians.

    Returns
    Type Description
    Matrix4

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateRotationX(Single, out Matrix4)

    Builds a rotation matrix for a rotation around the x-axis.

    Declaration
    public static void CreateRotationX(float angle, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single angle

    The counter-clockwise angle in radians.

    Matrix4 result

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateRotationY(Single)

    Builds a rotation matrix for a rotation around the y-axis.

    Declaration
    public static Matrix4 CreateRotationY(float angle)
    Parameters
    Type Name Description
    System.Single angle

    The counter-clockwise angle in radians.

    Returns
    Type Description
    Matrix4

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateRotationY(Single, out Matrix4)

    Builds a rotation matrix for a rotation around the y-axis.

    Declaration
    public static void CreateRotationY(float angle, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single angle

    The counter-clockwise angle in radians.

    Matrix4 result

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateRotationZ(Single)

    Builds a rotation matrix for a rotation around the z-axis.

    Declaration
    public static Matrix4 CreateRotationZ(float angle)
    Parameters
    Type Name Description
    System.Single angle

    The counter-clockwise angle in radians.

    Returns
    Type Description
    Matrix4

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateRotationZ(Single, out Matrix4)

    Builds a rotation matrix for a rotation around the z-axis.

    Declaration
    public static void CreateRotationZ(float angle, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single angle

    The counter-clockwise angle in radians.

    Matrix4 result

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateScale(Vector3)

    Creates a scale matrix.

    Declaration
    public static Matrix4 CreateScale(Vector3 scale)
    Parameters
    Type Name Description
    Vector3 scale

    Scale factors for the x, y, and z axes.

    Returns
    Type Description
    Matrix4

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(ref Vector3, out Matrix4)

    Creates a scale matrix.

    Declaration
    public static void CreateScale(ref Vector3 scale, out Matrix4 result)
    Parameters
    Type Name Description
    Vector3 scale

    Scale factors for the x, y, and z axes.

    Matrix4 result

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(Single)

    Creates a scale matrix.

    Declaration
    public static Matrix4 CreateScale(float scale)
    Parameters
    Type Name Description
    System.Single scale

    Single scale factor for the x, y, and z axes.

    Returns
    Type Description
    Matrix4

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(Single, out Matrix4)

    Creates a scale matrix.

    Declaration
    public static void CreateScale(float scale, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single scale

    Single scale factor for the x, y, and z axes.

    Matrix4 result

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(Single, Single, Single)

    Creates a scale matrix.

    Declaration
    public static Matrix4 CreateScale(float x, float y, float z)
    Parameters
    Type Name Description
    System.Single x

    Scale factor for the x axis.

    System.Single y

    Scale factor for the y axis.

    System.Single z

    Scale factor for the z axis.

    Returns
    Type Description
    Matrix4

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(Single, Single, Single, out Matrix4)

    Creates a scale matrix.

    Declaration
    public static void CreateScale(float x, float y, float z, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single x

    Scale factor for the x axis.

    System.Single y

    Scale factor for the y axis.

    System.Single z

    Scale factor for the z axis.

    Matrix4 result

    A scale matrix.

    | Improve this Doc View Source

    CreateTranslation(Vector3)

    Creates a translation matrix.

    Declaration
    public static Matrix4 CreateTranslation(Vector3 vector)
    Parameters
    Type Name Description
    Vector3 vector

    The translation vector.

    Returns
    Type Description
    Matrix4

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateTranslation(ref Vector3, out Matrix4)

    Creates a translation matrix.

    Declaration
    public static void CreateTranslation(ref Vector3 vector, out Matrix4 result)
    Parameters
    Type Name Description
    Vector3 vector

    The translation vector.

    Matrix4 result

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateTranslation(Single, Single, Single)

    Creates a translation matrix.

    Declaration
    public static Matrix4 CreateTranslation(float x, float y, float z)
    Parameters
    Type Name Description
    System.Single x

    X translation.

    System.Single y

    Y translation.

    System.Single z

    Z translation.

    Returns
    Type Description
    Matrix4

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    CreateTranslation(Single, Single, Single, out Matrix4)

    Creates a translation matrix.

    Declaration
    public static void CreateTranslation(float x, float y, float z, out Matrix4 result)
    Parameters
    Type Name Description
    System.Single x

    X translation.

    System.Single y

    Y translation.

    System.Single z

    Z translation.

    Matrix4 result

    The resulting Matrix4 instance.

    | Improve this Doc View Source

    Equals(Matrix4)

    Indicates whether the current matrix is equal to another matrix.

    Declaration
    public bool Equals(Matrix4 other)
    Parameters
    Type Name Description
    Matrix4 other

    An matrix to compare with this matrix.

    Returns
    Type Description
    System.Boolean

    true if the current matrix is equal to the matrix parameter; otherwise, false.

    | Improve this Doc View Source

    Equals(Object)

    Indicates whether this instance and a specified object are equal.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    The object to compare tresult.

    Returns
    Type Description
    System.Boolean

    True if the instances are equal; false otherwise.

    Overrides
    System.ValueType.Equals(System.Object)
    | Improve this Doc View Source

    ExtractProjection()

    Returns the projection component of this instance.

    Declaration
    public Vector4 ExtractProjection()
    Returns
    Type Description
    Vector4
    | Improve this Doc View Source

    ExtractRotation(Boolean)

    Returns the rotation component of this instance. Quite slow.

    Declaration
    public Quaternion ExtractRotation(bool row_normalise = true)
    Parameters
    Type Name Description
    System.Boolean row_normalise

    Whether the method should row-normalise (i.e. remove scale from) the Matrix. Pass false if you know it's already normalised.

    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    ExtractScale()

    Returns the scale component of this instance.

    Declaration
    public Vector3 ExtractScale()
    Returns
    Type Description
    Vector3
    | Improve this Doc View Source

    ExtractTranslation()

    Returns the translation component of this instance.

    Declaration
    public Vector3 ExtractTranslation()
    Returns
    Type Description
    Vector3
    | Improve this Doc View Source

    Frustum(Single, Single, Single, Single, Single, Single)

    Build a projection matrix

    Declaration
    [Obsolete("Use CreatePerspectiveOffCenter instead.")]
    public static Matrix4 Frustum(float left, float right, float bottom, float top, float near, float far)
    Parameters
    Type Name Description
    System.Single left

    Left edge of the view frustum

    System.Single right

    Right edge of the view frustum

    System.Single bottom

    Bottom edge of the view frustum

    System.Single top

    Top edge of the view frustum

    System.Single near

    Distance to the near clip plane

    System.Single far

    Distance to the far clip plane

    Returns
    Type Description
    Matrix4

    A projection matrix that transforms camera space to raster space

    | Improve this Doc View Source

    GetHashCode()

    Returns the hashcode for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    A System.Int32 containing the unique hashcode for this instance.

    Overrides
    System.ValueType.GetHashCode()
    | Improve this Doc View Source

    Invert()

    Converts this instance into its inverse.

    Declaration
    public void Invert()
    | Improve this Doc View Source

    Invert(Matrix4)

    Calculate the inverse of the given matrix

    Declaration
    public static Matrix4 Invert(Matrix4 mat)
    Parameters
    Type Name Description
    Matrix4 mat

    The matrix to invert

    Returns
    Type Description
    Matrix4

    The inverse of the given matrix if it has one, or the input if it is singular

    Exceptions
    Type Condition
    System.InvalidOperationException

    Thrown if the Matrix4 is singular.

    | Improve this Doc View Source

    Invert(ref Matrix4, out Matrix4)

    Calculate the inverse of the given matrix

    Declaration
    public static void Invert(ref Matrix4 mat, out Matrix4 result)
    Parameters
    Type Name Description
    Matrix4 mat

    The matrix to invert

    Matrix4 result

    The inverse of the given matrix if it has one, or the input if it is singular

    Exceptions
    Type Condition
    System.InvalidOperationException

    Thrown if the Matrix4 is singular.

    | Improve this Doc View Source

    Inverted()

    Returns an inverted copy of this instance.

    Declaration
    public Matrix4 Inverted()
    Returns
    Type Description
    Matrix4
    | Improve this Doc View Source

    LookAt(Vector3, Vector3, Vector3)

    Build a world space to camera space matrix

    Declaration
    public static Matrix4 LookAt(Vector3 eye, Vector3 target, Vector3 up)
    Parameters
    Type Name Description
    Vector3 eye

    Eye (camera) position in world space

    Vector3 target

    Target position in world space

    Vector3 up

    Up vector in world space (should not be parallel to the camera direction, that is target - eye)

    Returns
    Type Description
    Matrix4

    A Matrix4 that transforms world space to camera space

    | Improve this Doc View Source

    LookAt(Single, Single, Single, Single, Single, Single, Single, Single, Single)

    Build a world space to camera space matrix

    Declaration
    public static Matrix4 LookAt(float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ, float upX, float upY, float upZ)
    Parameters
    Type Name Description
    System.Single eyeX

    Eye (camera) position in world space

    System.Single eyeY

    Eye (camera) position in world space

    System.Single eyeZ

    Eye (camera) position in world space

    System.Single targetX

    Target position in world space

    System.Single targetY

    Target position in world space

    System.Single targetZ

    Target position in world space

    System.Single upX

    Up vector in world space (should not be parallel to the camera direction, that is target - eye)

    System.Single upY

    Up vector in world space (should not be parallel to the camera direction, that is target - eye)

    System.Single upZ

    Up vector in world space (should not be parallel to the camera direction, that is target - eye)

    Returns
    Type Description
    Matrix4

    A Matrix4 that transforms world space to camera space

    | Improve this Doc View Source

    Mult(Matrix4, Matrix4)

    Multiplies two instances.

    Declaration
    public static Matrix4 Mult(Matrix4 left, Matrix4 right)
    Parameters
    Type Name Description
    Matrix4 left

    The left operand of the multiplication.

    Matrix4 right

    The right operand of the multiplication.

    Returns
    Type Description
    Matrix4

    A new instance that is the result of the multiplication.

    | Improve this Doc View Source

    Mult(Matrix4, Single)

    Multiplies an instance by a scalar.

    Declaration
    public static Matrix4 Mult(Matrix4 left, float right)
    Parameters
    Type Name Description
    Matrix4 left

    The left operand of the multiplication.

    System.Single right

    The right operand of the multiplication.

    Returns
    Type Description
    Matrix4

    A new instance that is the result of the multiplication

    | Improve this Doc View Source

    Mult(ref Matrix4, ref Matrix4, out Matrix4)

    Multiplies two instances.

    Declaration
    public static void Mult(ref Matrix4 left, ref Matrix4 right, out Matrix4 result)
    Parameters
    Type Name Description
    Matrix4 left

    The left operand of the multiplication.

    Matrix4 right

    The right operand of the multiplication.

    Matrix4 result

    A new instance that is the result of the multiplication.

    | Improve this Doc View Source

    Mult(ref Matrix4, Single, out Matrix4)

    Multiplies an instance by a scalar.

    Declaration
    public static void Mult(ref Matrix4 left, float right, out Matrix4 result)
    Parameters
    Type Name Description
    Matrix4 left

    The left operand of the multiplication.

    System.Single right

    The right operand of the multiplication.

    Matrix4 result

    A new instance that is the result of the multiplication

    | Improve this Doc View Source

    Normalize()

    Divides each element in the Matrix by the Determinant.

    Declaration
    public void Normalize()
    | Improve this Doc View Source

    Normalized()

    Returns a normalised copy of this instance.

    Declaration
    public Matrix4 Normalized()
    Returns
    Type Description
    Matrix4
    | Improve this Doc View Source

    Perspective(Single, Single, Single, Single)

    Build a projection matrix

    Declaration
    [Obsolete("Use CreatePerspectiveFieldOfView instead.")]
    public static Matrix4 Perspective(float fovy, float aspect, float near, float far)
    Parameters
    Type Name Description
    System.Single fovy

    Angle of the field of view in the y direction (in radians)

    System.Single aspect

    Aspect ratio of the view (width / height)

    System.Single near

    Distance to the near clip plane

    System.Single far

    Distance to the far clip plane

    Returns
    Type Description
    Matrix4

    A projection matrix that transforms camera space to raster space

    | Improve this Doc View Source

    Rotate(Quaternion)

    Build a rotation matrix from a quaternion

    Declaration
    [Obsolete("Use CreateFromQuaternion instead.")]
    public static Matrix4 Rotate(Quaternion q)
    Parameters
    Type Name Description
    Quaternion q

    the quaternion

    Returns
    Type Description
    Matrix4

    A rotation matrix

    | Improve this Doc View Source

    Rotate(Vector3, Single)

    Build a rotation matrix to rotate about the given axis

    Declaration
    [Obsolete("Use CreateFromAxisAngle instead.")]
    public static Matrix4 Rotate(Vector3 axis, float angle)
    Parameters
    Type Name Description
    Vector3 axis

    the axis to rotate about

    System.Single angle

    angle in radians to rotate counter-clockwise (looking in the direction of the given axis)

    Returns
    Type Description
    Matrix4

    A rotation matrix

    | Improve this Doc View Source

    RotateX(Single)

    Build a rotation matrix that rotates about the x-axis

    Declaration
    [Obsolete("Use CreateRotationX instead.")]
    public static Matrix4 RotateX(float angle)
    Parameters
    Type Name Description
    System.Single angle

    angle in radians to rotate counter-clockwise around the x-axis

    Returns
    Type Description
    Matrix4

    A rotation matrix

    | Improve this Doc View Source

    RotateY(Single)

    Build a rotation matrix that rotates about the y-axis

    Declaration
    [Obsolete("Use CreateRotationY instead.")]
    public static Matrix4 RotateY(float angle)
    Parameters
    Type Name Description
    System.Single angle

    angle in radians to rotate counter-clockwise around the y-axis

    Returns
    Type Description
    Matrix4

    A rotation matrix

    | Improve this Doc View Source

    RotateZ(Single)

    Build a rotation matrix that rotates about the z-axis

    Declaration
    [Obsolete("Use CreateRotationZ instead.")]
    public static Matrix4 RotateZ(float angle)
    Parameters
    Type Name Description
    System.Single angle

    angle in radians to rotate counter-clockwise around the z-axis

    Returns
    Type Description
    Matrix4

    A rotation matrix

    | Improve this Doc View Source

    Scale(Vector3)

    Build a scaling matrix

    Declaration
    [Obsolete("Use CreateScale instead.")]
    public static Matrix4 Scale(Vector3 scale)
    Parameters
    Type Name Description
    Vector3 scale

    Scale factors for x,y and z axes

    Returns
    Type Description
    Matrix4

    A scaling matrix

    | Improve this Doc View Source

    Scale(Single)

    Build a scaling matrix

    Declaration
    [Obsolete("Use CreateScale instead.")]
    public static Matrix4 Scale(float scale)
    Parameters
    Type Name Description
    System.Single scale

    Single scale factor for x,y and z axes

    Returns
    Type Description
    Matrix4

    A scaling matrix

    | Improve this Doc View Source

    Scale(Single, Single, Single)

    Build a scaling matrix

    Declaration
    [Obsolete("Use CreateScale instead.")]
    public static Matrix4 Scale(float x, float y, float z)
    Parameters
    Type Name Description
    System.Single x

    Scale factor for x-axis

    System.Single y

    Scale factor for y-axis

    System.Single z

    Scale factor for z-axis

    Returns
    Type Description
    Matrix4

    A scaling matrix

    | Improve this Doc View Source

    Subtract(Matrix4, Matrix4)

    Subtracts one instance from another.

    Declaration
    public static Matrix4 Subtract(Matrix4 left, Matrix4 right)
    Parameters
    Type Name Description
    Matrix4 left

    The left operand of the subraction.

    Matrix4 right

    The right operand of the subraction.

    Returns
    Type Description
    Matrix4

    A new instance that is the result of the subraction.

    | Improve this Doc View Source

    Subtract(ref Matrix4, ref Matrix4, out Matrix4)

    Subtracts one instance from another.

    Declaration
    public static void Subtract(ref Matrix4 left, ref Matrix4 right, out Matrix4 result)
    Parameters
    Type Name Description
    Matrix4 left

    The left operand of the subraction.

    Matrix4 right

    The right operand of the subraction.

    Matrix4 result

    A new instance that is the result of the subraction.

    | Improve this Doc View Source

    ToString()

    Returns a System.String that represents the current Matrix4.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    The string representation of the matrix.

    Overrides
    System.ValueType.ToString()
    | Improve this Doc View Source

    Translation(Vector3)

    Builds a translation matrix.

    Declaration
    [Obsolete("Use CreateTranslation instead.")]
    public static Matrix4 Translation(Vector3 trans)
    Parameters
    Type Name Description
    Vector3 trans

    The translation vector.

    Returns
    Type Description
    Matrix4

    A new Matrix4 instance.

    | Improve this Doc View Source

    Translation(Single, Single, Single)

    Build a translation matrix with the given translation

    Declaration
    [Obsolete("Use CreateTranslation instead.")]
    public static Matrix4 Translation(float x, float y, float z)
    Parameters
    Type Name Description
    System.Single x

    X translation

    System.Single y

    Y translation

    System.Single z

    Z translation

    Returns
    Type Description
    Matrix4

    A Translation matrix

    | Improve this Doc View Source

    Transpose()

    Converts this instance into its transpose.

    Declaration
    public void Transpose()
    | Improve this Doc View Source

    Transpose(Matrix4)

    Calculate the transpose of the given matrix

    Declaration
    public static Matrix4 Transpose(Matrix4 mat)
    Parameters
    Type Name Description
    Matrix4 mat

    The matrix to transpose

    Returns
    Type Description
    Matrix4

    The transpose of the given matrix

    | Improve this Doc View Source

    Transpose(ref Matrix4, out Matrix4)

    Calculate the transpose of the given matrix

    Declaration
    public static void Transpose(ref Matrix4 mat, out Matrix4 result)
    Parameters
    Type Name Description
    Matrix4 mat

    The matrix to transpose

    Matrix4 result

    The result of the calculation

    Operators

    | Improve this Doc View Source

    Addition(Matrix4, Matrix4)

    Matrix addition

    Declaration
    public static Matrix4 operator +(Matrix4 left, Matrix4 right)
    Parameters
    Type Name Description
    Matrix4 left

    left-hand operand

    Matrix4 right

    right-hand operand

    Returns
    Type Description
    Matrix4

    A new Matrix4 which holds the result of the addition

    | Improve this Doc View Source

    Equality(Matrix4, Matrix4)

    Compares two instances for equality.

    Declaration
    public static bool operator ==(Matrix4 left, Matrix4 right)
    Parameters
    Type Name Description
    Matrix4 left

    The first instance.

    Matrix4 right

    The second instance.

    Returns
    Type Description
    System.Boolean

    True, if left equals right; false otherwise.

    | Improve this Doc View Source

    Inequality(Matrix4, Matrix4)

    Compares two instances for inequality.

    Declaration
    public static bool operator !=(Matrix4 left, Matrix4 right)
    Parameters
    Type Name Description
    Matrix4 left

    The first instance.

    Matrix4 right

    The second instance.

    Returns
    Type Description
    System.Boolean

    True, if left does not equal right; false otherwise.

    | Improve this Doc View Source

    Multiply(Matrix4, Matrix4)

    Matrix multiplication

    Declaration
    public static Matrix4 operator *(Matrix4 left, Matrix4 right)
    Parameters
    Type Name Description
    Matrix4 left

    left-hand operand

    Matrix4 right

    right-hand operand

    Returns
    Type Description
    Matrix4

    A new Matrix4 which holds the result of the multiplication

    | Improve this Doc View Source

    Multiply(Matrix4, Single)

    Matrix-scalar multiplication

    Declaration
    public static Matrix4 operator *(Matrix4 left, float right)
    Parameters
    Type Name Description
    Matrix4 left

    left-hand operand

    System.Single right

    right-hand operand

    Returns
    Type Description
    Matrix4

    A new Matrix4 which holds the result of the multiplication

    | Improve this Doc View Source

    Subtraction(Matrix4, Matrix4)

    Matrix subtraction

    Declaration
    public static Matrix4 operator -(Matrix4 left, Matrix4 right)
    Parameters
    Type Name Description
    Matrix4 left

    left-hand operand

    Matrix4 right

    right-hand operand

    Returns
    Type Description
    Matrix4

    A new Matrix4 which holds the result of the subtraction

    Implements

    System.IEquatable<T>
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX