Search Results for

    Show / Hide Table of Contents

    Struct Matrix

    Defines a 4x4 matrix.

    Implements
    IEquatable<Matrix>
    Inherited Members
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: GTA.Math
    Assembly: ScriptHookVDotNet3.dll
    Syntax
    [Serializable]
    public struct Matrix : IEquatable<Matrix>

    Constructors

    | Improve this Doc View Source

    Matrix(Single[])

    Initializes a new instance of the Matrix structure.

    Declaration
    public Matrix(float[] values)
    Parameters
    Type Name Description
    Single[] values

    The values to assign to the components of the matrix. This must be an array with sixteen elements.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when values is null.

    ArgumentOutOfRangeException

    Thrown when values contains more or less than sixteen elements.

    Fields

    | Improve this Doc View Source

    M11

    Gets or sets the element of the matrix that exists in the first row and first column.

    Declaration
    public float M11
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M12

    Gets or sets the element of the matrix that exists in the first row and second column.

    Declaration
    public float M12
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M13

    Gets or sets the element of the matrix that exists in the first row and third column.

    Declaration
    public float M13
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M14

    Gets or sets the element of the matrix that exists in the first row and fourth column.

    Declaration
    public float M14
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M21

    Gets or sets the element of the matrix that exists in the second row and first column.

    Declaration
    public float M21
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M22

    Gets or sets the element of the matrix that exists in the second row and second column.

    Declaration
    public float M22
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M23

    Gets or sets the element of the matrix that exists in the second row and third column.

    Declaration
    public float M23
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M24

    Gets or sets the element of the matrix that exists in the second row and fourth column.

    Declaration
    public float M24
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M31

    Gets or sets the element of the matrix that exists in the third row and first column.

    Declaration
    public float M31
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M32

    Gets or sets the element of the matrix that exists in the third row and second column.

    Declaration
    public float M32
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M33

    Gets or sets the element of the matrix that exists in the third row and third column.

    Declaration
    public float M33
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M34

    Gets or sets the element of the matrix that exists in the third row and fourth column.

    Declaration
    public float M34
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M41

    Gets or sets the element of the matrix that exists in the fourth row and first column.

    Declaration
    public float M41
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M42

    Gets or sets the element of the matrix that exists in the fourth row and second column.

    Declaration
    public float M42
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M43

    Gets or sets the element of the matrix that exists in the fourth row and third column.

    Declaration
    public float M43
    Field Value
    Type Description
    Single
    | Improve this Doc View Source

    M44

    Gets or sets the element of the matrix that exists in the fourth row and fourth column.

    Declaration
    public float M44
    Field Value
    Type Description
    Single

    Properties

    | Improve this Doc View Source

    HasInverse

    Gets a value indicating whether this instance has an inverse matrix.

    Declaration
    public readonly bool HasInverse { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    Identity

    The identity Matrix.

    Declaration
    public static readonly Matrix Identity { get; }
    Property Value
    Type Description
    Matrix
    | Improve this Doc View Source

    IsIdentity

    Gets a value indicating whether this instance is an identity matrix.

    Declaration
    public readonly bool IsIdentity { get; }
    Property Value
    Type Description
    Boolean

    true if this instance is an identity matrix; otherwise, false.

    | Improve this Doc View Source

    Item[Int32]

    Gets or sets the component at the specified index.

    Declaration
    public float this[int index] { get; set; }
    Parameters
    Type Name Description
    Int32 index

    The zero-based index of the component to access.

    Property Value
    Type Description
    Single

    The value of the matrix component, depending on the index.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when the index is out of the range [0, 15].

    | Improve this Doc View Source

    Item[Int32, Int32]

    Gets or sets the component at the specified index.

    Declaration
    public float this[int row, int column] { get; set; }
    Parameters
    Type Name Description
    Int32 row

    The row of the matrix to access.

    Int32 column

    The column of the matrix to access.

    Property Value
    Type Description
    Single

    The value of the matrix component, depending on the index.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when the row or columnis out of the range [0, 3].

    | Improve this Doc View Source

    Zero

    A Matrix with all of its components set to zero.

    Declaration
    public static readonly Matrix Zero { get; }
    Property Value
    Type Description
    Matrix

    Methods

    | Improve this Doc View Source

    Add(Matrix, Matrix)

    Determines the sum of two matrices.

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

    The first matrix to add.

    Matrix right

    The second matrix to add.

    Returns
    Type Description
    Matrix

    The sum of the two matrices.

    | Improve this Doc View Source

    Determinant()

    Calculates the determinant of the matrix.

    Declaration
    public float Determinant()
    Returns
    Type Description
    Single

    The determinant of the matrix.

    | Improve this Doc View Source

    Divide(Matrix, Matrix)

    Determines the quotient of two matrices.

    Declaration
    public static Matrix Divide(Matrix left, Matrix right)
    Parameters
    Type Name Description
    Matrix left

    The first matrix to divide.

    Matrix right

    The second matrix to divide.

    Returns
    Type Description
    Matrix

    The quotient of the two matrices.

    | Improve this Doc View Source

    Divide(Matrix, Single)

    Scales a matrix by the given value.

    Declaration
    public static Matrix Divide(Matrix left, float right)
    Parameters
    Type Name Description
    Matrix left

    The matrix to scale.

    Single right

    The amount by which to scale.

    Returns
    Type Description
    Matrix

    The scaled matrix.

    | Improve this Doc View Source

    Equals(Matrix)

    Returns a value that indicates whether the current instance is equal to the specified object.

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

    Object to make the comparison with.

    Returns
    Type Description
    Boolean

    true if the current instance is equal to the specified object; false otherwise.

    | Improve this Doc View Source

    Equals(Object)

    Returns a value that indicates whether the current instance is equal to a specified object.

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

    Object to make the comparison with.

    Returns
    Type Description
    Boolean

    true if the current instance is equal to the specified object; false otherwise.

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

    GetHashCode()

    Returns the hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A 32-bit signed integer hash code.

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

    InverseTransformPoint(Vector3)

    Calculates the position of a point before this transformation matrix gets applied

    Declaration
    public Vector3 InverseTransformPoint(Vector3 point)
    Parameters
    Type Name Description
    Vector3 point

    The transformed vertex location

    Returns
    Type Description
    Vector3

    The original vertex location before being transformed by the given Matrix

    | Improve this Doc View Source

    Invert()

    Inverts the matrix.

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

    Invert(Matrix)

    Calculates the inverse of a matrix if it exists.

    Declaration
    public static Matrix Invert(Matrix matrix)
    Parameters
    Type Name Description
    Matrix matrix
    Returns
    Type Description
    Matrix

    The inverse of the matrix.

    | Improve this Doc View Source

    Lerp(Matrix, Matrix, Single)

    Performs a linear interpolation between two matrices.

    Declaration
    public static Matrix Lerp(Matrix start, Matrix end, float amount)
    Parameters
    Type Name Description
    Matrix start

    Start matrix.

    Matrix end

    End matrix.

    Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Type Description
    Matrix

    The linear interpolation of the two matrices.

    Remarks

    This method performs the linear interpolation based on the following formula.

    start + (end - start) * amount

    Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

    | Improve this Doc View Source

    Multiply(Matrix, Matrix)

    Determines the product of two matrices.

    Declaration
    public static Matrix Multiply(Matrix left, Matrix right)
    Parameters
    Type Name Description
    Matrix left

    The first matrix to multiply.

    Matrix right

    The second matrix to multiply.

    Returns
    Type Description
    Matrix

    The product of the two matrices.

    | Improve this Doc View Source

    Multiply(Matrix, Single)

    Scales a matrix by the given value.

    Declaration
    public static Matrix Multiply(Matrix left, float right)
    Parameters
    Type Name Description
    Matrix left

    The matrix to scale.

    Single right

    The amount by which to scale.

    Returns
    Type Description
    Matrix

    The scaled matrix.

    | Improve this Doc View Source

    Negate(Matrix)

    Negates a matrix.

    Declaration
    public static Matrix Negate(Matrix matrix)
    Parameters
    Type Name Description
    Matrix matrix

    The matrix to be negated.

    Returns
    Type Description
    Matrix

    The negated matrix.

    | Improve this Doc View Source

    RotationAxis(Vector3, Single)

    Creates a matrix that rotates around an arbitrary axis.

    Declaration
    public static Matrix RotationAxis(Vector3 axis, float angle)
    Parameters
    Type Name Description
    Vector3 axis

    The axis around which to rotate.

    Single angle

    Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

    Returns
    Type Description
    Matrix

    The created rotation matrix.

    | Improve this Doc View Source

    RotationQuaternion(Quaternion)

    Creates a rotation matrix from a rotation.

    Declaration
    public static Matrix RotationQuaternion(Quaternion rotation)
    Parameters
    Type Name Description
    Quaternion rotation

    The quaternion to use to build the matrix.

    Returns
    Type Description
    Matrix

    The created rotation matrix.

    | Improve this Doc View Source

    RotationX(Single)

    Creates a matrix that rotates around the x-axis.

    Declaration
    public static Matrix RotationX(float angle)
    Parameters
    Type Name Description
    Single angle

    Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

    Returns
    Type Description
    Matrix

    The created rotation matrix.

    | Improve this Doc View Source

    RotationY(Single)

    Creates a matrix that rotates around the y-axis.

    Declaration
    public static Matrix RotationY(float angle)
    Parameters
    Type Name Description
    Single angle

    Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

    Returns
    Type Description
    Matrix

    The created rotation matrix.

    | Improve this Doc View Source

    RotationYawPitchRoll(Single, Single, Single)

    Creates a rotation matrix with a specified yaw, pitch, and roll.

    Declaration
    public static Matrix RotationYawPitchRoll(float yaw, float pitch, float roll)
    Parameters
    Type Name Description
    Single yaw

    Yaw around the y-axis, in radians.

    Single pitch

    Pitch around the x-axis, in radians.

    Single roll

    Roll around the z-axis, in radians.

    Returns
    Type Description
    Matrix

    The created rotation matrix.

    | Improve this Doc View Source

    RotationZ(Single)

    Creates a matrix that rotates around the z-axis.

    Declaration
    public static Matrix RotationZ(float angle)
    Parameters
    Type Name Description
    Single angle

    Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.

    Returns
    Type Description
    Matrix

    The created rotation matrix.

    | Improve this Doc View Source

    Scaling(Vector3)

    Creates a matrix that scales along the x-axis, y-axis, and y-axis.

    Declaration
    public static Matrix Scaling(Vector3 scale)
    Parameters
    Type Name Description
    Vector3 scale

    Scaling factor for all three axes.

    Returns
    Type Description
    Matrix

    The created scaling matrix.

    | Improve this Doc View Source

    Scaling(Single, Single, Single)

    Creates a matrix that scales along the x-axis, y-axis, and y-axis.

    Declaration
    public static Matrix Scaling(float x, float y, float z)
    Parameters
    Type Name Description
    Single x

    Scaling factor that is applied along the x-axis.

    Single y

    Scaling factor that is applied along the y-axis.

    Single z

    Scaling factor that is applied along the z-axis.

    Returns
    Type Description
    Matrix

    The created scaling matrix.

    | Improve this Doc View Source

    Subtract(Matrix, Matrix)

    Determines the difference between two matrices.

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

    The first matrix to subtract.

    Matrix right

    The second matrix to subtract.

    Returns
    Type Description
    Matrix

    The difference between the two matrices.

    | Improve this Doc View Source

    ToArray()

    Converts the matrix to an array of floats.

    Declaration
    public float[] ToArray()
    Returns
    Type Description
    Single[]
    | Improve this Doc View Source

    ToString()

    Converts the value of the object to its equivalent string representation.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    The string representation of the value of this instance.

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

    ToString(String)

    Converts the value of the object to its equivalent string representation.

    Declaration
    public string ToString(string format)
    Parameters
    Type Name Description
    String format

    The format.

    Returns
    Type Description
    String

    The string representation of the value of this instance.

    | Improve this Doc View Source

    TransformPoint(Vector3)

    Apply the transformation matrix to a point in world space

    Declaration
    public Vector3 TransformPoint(Vector3 point)
    Parameters
    Type Name Description
    Vector3 point

    The original vertex location

    Returns
    Type Description
    Vector3

    The vertex location transformed by the given Matrix

    | Improve this Doc View Source

    Translation(Vector3)

    Creates a translation matrix using the specified offsets.

    Declaration
    public static Matrix Translation(Vector3 amount)
    Parameters
    Type Name Description
    Vector3 amount

    The offset for all three coordinate planes.

    Returns
    Type Description
    Matrix

    The created translation matrix.

    | Improve this Doc View Source

    Translation(Single, Single, Single)

    Creates a translation matrix using the specified offsets.

    Declaration
    public static Matrix Translation(float x, float y, float z)
    Parameters
    Type Name Description
    Single x

    X-coordinate offset.

    Single y

    Y-coordinate offset.

    Single z

    Z-coordinate offset.

    Returns
    Type Description
    Matrix

    The created translation matrix.

    | Improve this Doc View Source

    Transpose(Matrix)

    Calculates the transpose of the specified matrix.

    Declaration
    public static Matrix Transpose(Matrix matrix)
    Parameters
    Type Name Description
    Matrix matrix

    The matrix whose transpose is to be calculated.

    Returns
    Type Description
    Matrix

    The transpose of the specified matrix.

    Operators

    | Improve this Doc View Source

    Addition(Matrix, Matrix)

    Adds two matrices.

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

    The first matrix to add.

    Matrix right

    The second matrix to add.

    Returns
    Type Description
    Matrix

    The sum of the two matrices.

    | Improve this Doc View Source

    Division(Matrix, Matrix)

    Divides two matrices.

    Declaration
    public static Matrix operator /(Matrix left, Matrix right)
    Parameters
    Type Name Description
    Matrix left

    The first matrix to divide.

    Matrix right

    The second matrix to divide.

    Returns
    Type Description
    Matrix

    The quotient of the two matrices.

    | Improve this Doc View Source

    Division(Matrix, Single)

    Scales a matrix by a given value.

    Declaration
    public static Matrix operator /(Matrix left, float right)
    Parameters
    Type Name Description
    Matrix left

    The matrix to scale.

    Single right

    The amount by which to scale.

    Returns
    Type Description
    Matrix

    The scaled matrix.

    | Improve this Doc View Source

    Equality(Matrix, Matrix)

    Tests for equality between two objects.

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

    The first value to compare.

    Matrix right

    The second value to compare.

    Returns
    Type Description
    Boolean

    true if left has the same value as right; otherwise, false.

    | Improve this Doc View Source

    Inequality(Matrix, Matrix)

    Tests for inequality between two objects.

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

    The first value to compare.

    Matrix right

    The second value to compare.

    Returns
    Type Description
    Boolean

    true if left has a different value than right; otherwise, false.

    | Improve this Doc View Source

    Multiply(Matrix, Matrix)

    Multiplies two matrices.

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

    The first matrix to multiply.

    Matrix right

    The second matrix to multiply.

    Returns
    Type Description
    Matrix

    The product of the two matrices.

    | Improve this Doc View Source

    Multiply(Matrix, Single)

    Scales a matrix by a given value.

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

    The matrix to scale.

    Single right

    The amount by which to scale.

    Returns
    Type Description
    Matrix

    The scaled matrix.

    | Improve this Doc View Source

    Multiply(Single, Matrix)

    Scales a matrix by a given value.

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

    The amount by which to scale.

    Matrix right

    The matrix to scale.

    Returns
    Type Description
    Matrix

    The scaled matrix.

    | Improve this Doc View Source

    Subtraction(Matrix, Matrix)

    Subtracts two matrices.

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

    The first matrix to subtract.

    Matrix right

    The second matrix to subtract.

    Returns
    Type Description
    Matrix

    The difference between the two matrices.

    | Improve this Doc View Source

    UnaryNegation(Matrix)

    Negates a matrix.

    Declaration
    public static Matrix operator -(Matrix matrix)
    Parameters
    Type Name Description
    Matrix matrix

    The matrix to negate.

    Returns
    Type Description
    Matrix

    The negated matrix.

    Implements

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