Show / Hide Table of Contents

    Struct Matrix3

    Represents a 3x3 matrix containing 3D rotation and scale.

    Implements
    System.IEquatable<Matrix3>
    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 Matrix3 : IEquatable<Matrix3>

    Constructors

    | Improve this Doc View Source

    Matrix3(Matrix4)

    Constructs a new instance.

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

    A Matrix4 to take the upper-left 3x3 from.

    | Improve this Doc View Source

    Matrix3(Vector3, Vector3, Vector3)

    Constructs a new instance.

    Declaration
    public Matrix3(Vector3 row0, Vector3 row1, Vector3 row2)
    Parameters
    Type Name Description
    Vector3 row0

    Top row of the matrix

    Vector3 row1

    Second row of the matrix

    Vector3 row2

    Bottom row of the matrix

    | Improve this Doc View Source

    Matrix3(Single, Single, Single, Single, Single, Single, Single, Single, Single)

    Constructs a new instance.

    Declaration
    public Matrix3(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
    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 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 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.

    Fields

    | Improve this Doc View Source

    Identity

    The identity matrix.

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

    Row0

    First row of the matrix.

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

    Row1

    Second row of the matrix.

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

    Row2

    Third row of the matrix.

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

    Zero

    The zero matrix.

    Declaration
    public static readonly Matrix3 Zero
    Field Value
    Type Description
    Matrix3

    Properties

    | Improve this Doc View Source

    Column0

    Gets the first column of this matrix.

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

    Column1

    Gets the second column of this matrix.

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

    Column2

    Gets the third column of this matrix.

    Declaration
    public Vector3 Column2 { get; }
    Property Value
    Type Description
    Vector3
    | 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 Vector3 Diagonal { get; set; }
    Property Value
    Type Description
    Vector3
    | 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

    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

    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

    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(Matrix3, Matrix3)

    Adds two instances.

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

    The left operand of the addition.

    Matrix3 right

    The right operand of the addition.

    Returns
    Type Description
    Matrix3

    A new instance that is the result of the addition.

    | Improve this Doc View Source

    Add(ref Matrix3, ref Matrix3, out Matrix3)

    Adds two instances.

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

    The left operand of the addition.

    Matrix3 right

    The right operand of the addition.

    Matrix3 result

    A new instance that is the result of the addition.

    | Improve this Doc View Source

    ClearRotation()

    Returns a copy of this Matrix3 without rotation.

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

    ClearScale()

    Returns a copy of this Matrix3 without scale.

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

    CreateFromAxisAngle(Vector3, Single)

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

    Declaration
    public static Matrix3 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
    Matrix3

    A matrix instance.

    | Improve this Doc View Source

    CreateFromAxisAngle(Vector3, Single, out Matrix3)

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

    Declaration
    public static void CreateFromAxisAngle(Vector3 axis, float angle, out Matrix3 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).

    Matrix3 result

    A matrix instance.

    | Improve this Doc View Source

    CreateFromQuaternion(Quaternion)

    Build a rotation matrix from the specified quaternion.

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

    Quaternion to translate.

    Returns
    Type Description
    Matrix3

    A matrix instance.

    | Improve this Doc View Source

    CreateFromQuaternion(ref Quaternion, out Matrix3)

    Build a rotation matrix from the specified quaternion.

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

    Quaternion to translate.

    Matrix3 result

    Matrix result.

    | Improve this Doc View Source

    CreateRotationX(Single)

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

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

    The counter-clockwise angle in radians.

    Returns
    Type Description
    Matrix3

    The resulting Matrix3 instance.

    | Improve this Doc View Source

    CreateRotationX(Single, out Matrix3)

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

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

    The counter-clockwise angle in radians.

    Matrix3 result

    The resulting Matrix3 instance.

    | Improve this Doc View Source

    CreateRotationY(Single)

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

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

    The counter-clockwise angle in radians.

    Returns
    Type Description
    Matrix3

    The resulting Matrix3 instance.

    | Improve this Doc View Source

    CreateRotationY(Single, out Matrix3)

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

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

    The counter-clockwise angle in radians.

    Matrix3 result

    The resulting Matrix3 instance.

    | Improve this Doc View Source

    CreateRotationZ(Single)

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

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

    The counter-clockwise angle in radians.

    Returns
    Type Description
    Matrix3

    The resulting Matrix3 instance.

    | Improve this Doc View Source

    CreateRotationZ(Single, out Matrix3)

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

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

    The counter-clockwise angle in radians.

    Matrix3 result

    The resulting Matrix3 instance.

    | Improve this Doc View Source

    CreateScale(Vector3)

    Creates a scale matrix.

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

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

    Returns
    Type Description
    Matrix3

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(ref Vector3, out Matrix3)

    Creates a scale matrix.

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

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

    Matrix3 result

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(Single)

    Creates a scale matrix.

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

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

    Returns
    Type Description
    Matrix3

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(Single, out Matrix3)

    Creates a scale matrix.

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

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

    Matrix3 result

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(Single, Single, Single)

    Creates a scale matrix.

    Declaration
    public static Matrix3 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
    Matrix3

    A scale matrix.

    | Improve this Doc View Source

    CreateScale(Single, Single, Single, out Matrix3)

    Creates a scale matrix.

    Declaration
    public static void CreateScale(float x, float y, float z, out Matrix3 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.

    Matrix3 result

    A scale matrix.

    | Improve this Doc View Source

    Equals(Matrix3)

    Indicates whether the current matrix is equal to another matrix.

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

    A 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 to.

    Returns
    Type Description
    System.Boolean

    True if the instances are equal; false otherwise.

    Overrides
    System.ValueType.Equals(System.Object)
    | 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

    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(Matrix3)

    Calculate the inverse of the given matrix

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

    The matrix to invert

    Returns
    Type Description
    Matrix3

    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 Matrix3, out Matrix3)

    Calculate the inverse of the given matrix

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

    The matrix to invert

    Matrix3 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 Matrix3 is singular.

    | Improve this Doc View Source

    Inverted()

    Returns an inverted copy of this instance.

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

    Mult(Matrix3, Matrix3)

    Multiplies two instances.

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

    The left operand of the multiplication.

    Matrix3 right

    The right operand of the multiplication.

    Returns
    Type Description
    Matrix3

    A new instance that is the result of the multiplication

    | Improve this Doc View Source

    Mult(ref Matrix3, ref Matrix3, out Matrix3)

    Multiplies two instances.

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

    The left operand of the multiplication.

    Matrix3 right

    The right operand of the multiplication.

    Matrix3 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 Matrix3 Normalized()
    Returns
    Type Description
    Matrix3
    | Improve this Doc View Source

    ToString()

    Returns a System.String that represents the current Matrix3d.

    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

    Transpose()

    Converts this instance into its transpose.

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

    Transpose(Matrix3)

    Calculate the transpose of the given matrix

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

    The matrix to transpose

    Returns
    Type Description
    Matrix3

    The transpose of the given matrix

    | Improve this Doc View Source

    Transpose(ref Matrix3, out Matrix3)

    Calculate the transpose of the given matrix

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

    The matrix to transpose

    Matrix3 result

    The result of the calculation

    Operators

    | Improve this Doc View Source

    Equality(Matrix3, Matrix3)

    Compares two instances for equality.

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

    The first instance.

    Matrix3 right

    The second instance.

    Returns
    Type Description
    System.Boolean

    True, if left equals right; false otherwise.

    | Improve this Doc View Source

    Inequality(Matrix3, Matrix3)

    Compares two instances for inequality.

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

    The first instance.

    Matrix3 right

    The second instance.

    Returns
    Type Description
    System.Boolean

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

    | Improve this Doc View Source

    Multiply(Matrix3, Matrix3)

    Matrix multiplication

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

    left-hand operand

    Matrix3 right

    right-hand operand

    Returns
    Type Description
    Matrix3

    A new Matrix3d which holds the result of the multiplication

    Implements

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