Search Results for

    Show / Hide Table of Contents

    Class Matrix2x2

    Represents a 2x2 Matrix (contains only scale and rotation in 2D).

    Inheritance
    System.Object
    Matrix2x2
    Implements
    System.IEquatable<Matrix2x2>
    System.IFormattable
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    public sealed class Matrix2x2 : ValueType, IEquatable<Matrix2x2>, IFormattable

    Constructors

    Matrix2x2(Single)

    Initializes a new instance of the Matrix2x2 struct.

    Declaration
    public Matrix2x2(float value)
    Parameters
    System.Single value

    The value that will be assigned to all components.

    Matrix2x2(Single, Single, Single, Single)

    Initializes a new instance of the Matrix2x2 struct.

    Declaration
    public Matrix2x2(float m11, float m12, float m21, float m22)
    Parameters
    System.Single m11

    The value to assign at row 1 column 1 of the Matrix2x2.

    System.Single m12

    The value to assign at row 1 column 2 of the Matrix2x2.

    System.Single m21

    The value to assign at row 2 column 1 of the Matrix2x2.

    System.Single m22

    The value to assign at row 2 column 2 of the Matrix2x2.

    Matrix2x2(Single[])

    Initializes a new instance of the Matrix2x2 struct.

    Declaration
    public Matrix2x2(float[] values)
    Parameters
    System.Single[] values

    The values to assign to the components of the Matrix2x2. This must be an array with four elements.

    Exceptions
    System.ArgumentNullException

    Thrown when values is null.

    System.ArgumentOutOfRangeException

    Thrown when values contains more or less than four elements.

    Fields

    Identity

    The identity Matrix2x2.

    Declaration
    public static readonly Matrix2x2 Identity
    Field Value
    Matrix2x2

    M11

    Value at row 1 column 1 of the Matrix2x2.

    Declaration
    public float M11
    Field Value
    System.Single

    M12

    Value at row 1 column 2 of the Matrix2x2.

    Declaration
    public float M12
    Field Value
    System.Single

    M21

    Value at row 2 column 1 of the Matrix2x2.

    Declaration
    public float M21
    Field Value
    System.Single

    M22

    Value at row 2 column 2 of the Matrix2x2.

    Declaration
    public float M22
    Field Value
    System.Single

    SizeInBytes

    The size of the Matrix2x2 type, in bytes.

    Declaration
    public static readonly int SizeInBytes
    Field Value
    System.Int32

    Zero

    A Matrix2x2 with all of its components set to zero.

    Declaration
    public static readonly Matrix2x2 Zero
    Field Value
    Matrix2x2

    Properties

    Column1

    Gets or sets the first column in the Matrix2x2; that is M11, M21

    Declaration
    public Float2 Column1 { get; set; }
    Property Value
    Float2

    Column2

    Gets or sets the second column in the Matrix2x2; that is M12, M22

    Declaration
    public Float2 Column2 { get; set; }
    Property Value
    Float2

    IsIdentity

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

    Declaration
    public bool IsIdentity { get; }
    Property Value
    System.Boolean

    Item[Int32]

    Gets or sets the component at the specified index.

    Declaration
    public float this[int index] { get; set; }
    Parameters
    System.Int32 index

    The zero-based index of the component to access.

    Property Value
    System.Single

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

    Exceptions
    System.ArgumentOutOfRangeException

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

    Item[Int32, Int32]

    Gets or sets the component at the specified index.

    Declaration
    public float this[int row, int column] { get; set; }
    Parameters
    System.Int32 row

    The row of the Matrix2x2 to access.

    System.Int32 column

    The column of the Matrix2x2 to access.

    Property Value
    System.Single

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

    Exceptions
    System.ArgumentOutOfRangeException

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

    Row1

    Gets or sets the first row in the Matrix2x2; that is M11, M12

    Declaration
    public Float2 Row1 { get; set; }
    Property Value
    Float2

    Row2

    Gets or sets the second row in the Matrix2x2; that is M21, M22

    Declaration
    public Float2 Row2 { get; set; }
    Property Value
    Float2

    ScaleVector

    Gets or sets the scale of the Matrix2x2; that is M11, M22.

    Declaration
    public Float2 ScaleVector { get; set; }
    Property Value
    Float2

    Methods

    Determinant()

    Calculates the determinant of the Matrix2x2.

    Declaration
    public float Determinant()
    Returns
    System.Single

    The determinant of the Matrix2x2.

    Equals(Matrix2x2)

    Determines whether the specified Matrix2x2 is equal to this instance.

    Declaration
    public bool Equals(Matrix2x2 other)
    Parameters
    Matrix2x2 other

    The Matrix2x2 to compare with this instance.

    Returns
    System.Boolean

    true if the specified Matrix2x2 is equal to this instance; otherwise, false.

    Equals(ref Matrix2x2)

    Determines whether the specified Matrix2x2 is equal to this instance.

    Declaration
    public bool Equals(ref Matrix2x2 other)
    Parameters
    Matrix2x2 other

    The Matrix2x2 to compare with this instance.

    Returns
    System.Boolean

    true if the specified Matrix2x2 is equal to this instance; otherwise, false.

    Equals(ref Matrix2x2, ref Matrix2x2)

    Determines whether the specified Matrix2x2 are equal.

    Declaration
    public static bool Equals(ref Matrix2x2 a, ref Matrix2x2 b)
    Parameters
    Matrix2x2 a

    Matrix2x2 b

    Returns
    System.Boolean

    Equals(Object)

    Determines whether the specified System.Object is equal to this instance.

    Declaration
    public override bool Equals(object value)
    Parameters
    System.Object value

    The System.Object to compare with this instance.

    Returns
    System.Boolean

    true if the specified System.Object is equal to this instance; otherwise, false.

    GetHashCode()

    Returns a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    System.Int32

    A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

    InverseDeterminant()

    Calculates inverse of the determinant of the Matrix2x2.

    Declaration
    public float InverseDeterminant()
    Returns
    System.Single

    The inverse determinant of the Matrix2x2.

    Invert(ref Matrix2x2, out Matrix2x2)

    Calculates the inverse of the specified Matrix2x2.

    Declaration
    public static void Invert(ref Matrix2x2 value, out Matrix2x2 result)
    Parameters
    Matrix2x2 value

    The Matrix2x2 whose inverse is to be calculated.

    Matrix2x2 result

    When the method completes, contains the inverse of the specified Matrix2x2.

    Multiply(ref Matrix2x2, ref Matrix2x2, out Matrix2x2)

    Determines the product of two matrices.

    Declaration
    public static void Multiply(ref Matrix2x2 left, ref Matrix2x2 right, out Matrix2x2 result)
    Parameters
    Matrix2x2 left

    The first Matrix2x2 to multiply.

    Matrix2x2 right

    The second Matrix2x2 to multiply.

    Matrix2x2 result

    The product of the two matrices.

    Rotation(Single, out Matrix2x2)

    Creates the rotation matrix.

    Declaration
    public static void Rotation(float rotationRadians, out Matrix2x2 result)
    Parameters
    System.Single rotationRadians

    The rotation angle (in radians).

    Matrix2x2 result

    The result.

    Scale(ref Float2, out Matrix2x2)

    Creates the scale matrix.

    Declaration
    public static void Scale(ref Float2 scale, out Matrix2x2 result)
    Parameters
    Float2 scale

    The scale vector.

    Matrix2x2 result

    The result.

    Scale(Single, out Matrix2x2)

    Creates the uniform scale matrix.

    Declaration
    public static void Scale(float scale, out Matrix2x2 result)
    Parameters
    System.Single scale

    The scale.

    Matrix2x2 result

    The result.

    Scale(Single, Single, out Matrix2x2)

    Creates the scale matrix.

    Declaration
    public static void Scale(float scaleX, float scaleY, out Matrix2x2 result)
    Parameters
    System.Single scaleX

    The scale x.

    System.Single scaleY

    The scale y.

    Matrix2x2 result

    The result.

    Shear(ref Float2, out Matrix2x2)

    Creates the shear matrix. Represented by: [1 Y] [X 1]

    Declaration
    public static void Shear(ref Float2 shearAngles, out Matrix2x2 result)
    Parameters
    Float2 shearAngles

    The shear angles.

    Matrix2x2 result

    The result.

    ToArray()

    Creates an array containing the elements of the Matrix2x2.

    Declaration
    public float[] ToArray()
    Returns
    System.Single[]

    A 4-element array containing the components of the Matrix2x2.

    ToString()

    Returns a System.String that represents this instance.

    Declaration
    public override string ToString()
    Returns
    System.String

    A System.String that represents this instance.

    ToString(IFormatProvider)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(IFormatProvider formatProvider)
    Parameters
    System.IFormatProvider formatProvider

    The format provider.

    Returns
    System.String

    A System.String that represents this instance.

    ToString(String)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(string format)
    Parameters
    System.String format

    The format.

    Returns
    System.String

    A System.String that represents this instance.

    ToString(String, IFormatProvider)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(string format, IFormatProvider formatProvider)
    Parameters
    System.String format

    The format.

    System.IFormatProvider formatProvider

    The format provider.

    Returns
    System.String

    A System.String that represents this instance.

    Transform(ref Float2, ref Matrix2x2, out Float2)

    Transforms the specified vector by the given matrix.

    Declaration
    public static void Transform(ref Float2 vector, ref Matrix2x2 matrix, out Float2 result)
    Parameters
    Float2 vector

    The vector.

    Matrix2x2 matrix

    The matrix.

    Float2 result

    The result.

    Operators

    Equality(Matrix2x2, Matrix2x2)

    Tests for equality between two objects.

    Declaration
    public static bool operator ==(Matrix2x2 left, Matrix2x2 right)
    Parameters
    Matrix2x2 left

    The first value to compare.

    Matrix2x2 right

    The second value to compare.

    Returns
    System.Boolean

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

    Explicit(Matrix to Matrix2x2)

    Convert the 4x4 Matrix to a 3x3 Matrix.

    Declaration
    public static explicit operator Matrix2x2(Matrix value)
    Parameters
    Matrix value

    Returns
    Matrix2x2

    A 2x2 Matrix

    Explicit(Matrix2x2 to Matrix)

    Convert the 2x2 Matrix to a 4x4 Matrix.

    Declaration
    public static explicit operator Matrix(Matrix2x2 value)
    Parameters
    Matrix2x2 value

    Returns
    Matrix

    A 4x4 Matrix with zero translation and M44=1

    Explicit(Matrix2x2 to Matrix3x3)

    Convert the 2x2 Matrix to a 4x4 Matrix.

    Declaration
    public static explicit operator Matrix3x3(Matrix2x2 value)
    Parameters
    Matrix2x2 value

    Returns
    Matrix3x3

    A 3x3 Matrix with zero translation and M44=1

    Explicit(Matrix3x3 to Matrix2x2)

    Convert the 3x3 Matrix to a 2x2 Matrix.

    Declaration
    public static explicit operator Matrix2x2(Matrix3x3 value)
    Parameters
    Matrix3x3 value

    Returns
    Matrix2x2

    A 2x2 Matrix

    Inequality(Matrix2x2, Matrix2x2)

    Tests for inequality between two objects.

    Declaration
    public static bool operator !=(Matrix2x2 left, Matrix2x2 right)
    Parameters
    Matrix2x2 left

    The first value to compare.

    Matrix2x2 right

    The second value to compare.

    Returns
    System.Boolean

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

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat