Vixen
02b45cc4
csharp
public readonly struct Matrix3x3

A 3×3 matrix: rotations and scales with no translation. The type Numerics does not have, and the one a shader wants for normals — nine floats instead of sixteen, in a constant buffer that is read per vertex.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Same conventions as Matrix4x4: row-vector, row-major, composing left to right.

Fields and properties (14)

  • public const int ComponentCount

    Number of components.

  • public readonly float M11

    Row 1, column 1.

  • public readonly float M12

    Row 1, column 2.

  • public readonly float M13

    Row 1, column 3.

  • public readonly float M21

    Row 2, column 1.

  • public readonly float M22

    Row 2, column 2.

  • public readonly float M23

    Row 2, column 3.

  • public readonly float M31

    Row 3, column 1.

  • public readonly float M32

    Row 3, column 2.

  • public readonly float M33

    Row 3, column 3.

  • public static Matrix3x3 Identity

    The transform that does nothing.

  • public Vector3 Row1

    The first row.

  • public Vector3 Row2

    The second row.

  • public Vector3 Row3

    The third row.

Methods (23)

  • public Matrix3x3(float m11, float m12, float m13, float m21, float m22, float m23, float m31, float m32, float m33)

    Builds a matrix from its nine elements, in row-major order.

  • public Matrix3x3(Vector3 row1, Vector3 row2, Vector3 row3)

    Builds a matrix from its three rows.

  • public ReadOnlySpan<float> AsSpan()

    The elements in row-major order. Valid as long as the matrix it came from.

  • public static Matrix3x3 FromMatrix4x4(in Matrix4x4 matrix)

    The upper-left 3×3 of a 4×4 — its rotation and scale, without the translation.

  • public static Matrix3x3 FromQuaternion(Quaternion rotation)

    The rotation a quaternion describes, as a 3×3 matrix.

  • public static Matrix3x3 FromScale(Vector3 scale)

    Scales each axis independently.

  • public static Matrix3x3 Normal(in Matrix4x4 modelToWorld)

    The matrix that transforms normals under : the inverse transpose of its upper-left 3×3.

  • public static Matrix3x3 Multiply(in Matrix3x3 left, in Matrix3x3 right)

    Composes two transforms: apply , then .

  • public static Matrix3x3 Transpose(in Matrix3x3 matrix)

    Transposes the matrix.

  • public static float Determinant(in Matrix3x3 matrix)

    The determinant.

  • public static bool Invert(in Matrix3x3 matrix, out Matrix3x3 result)

    Inverts the matrix.

  • public static Vector3 Transform(Vector3 value, in Matrix3x3 matrix)

    Transforms a vector: v * M.

  • public static bool NearEqual(in Matrix3x3 left, in Matrix3x3 right, float tolerance = 1E-06)

    Whether two matrices agree to within a tolerance, element by element.

  • public static Matrix3x3 operator *(Matrix3x3 left, Matrix3x3 right)
  • public static Vector3 operator *(Vector3 value, Matrix3x3 matrix)

    Transforms a row vector: v * M.

  • public static bool operator ==(Matrix3x3 left, Matrix3x3 right)

    Exact element-wise equality, IEEE semantics. See NearEqual.

  • public static bool operator !=(Matrix3x3 left, Matrix3x3 right)

    The negation of op_Equality.

  • public bool Equals(Matrix3x3 other)

    Indicates whether the current object is equal to another object of the same type.

  • public override bool Equals(object? obj)

    Indicates whether this instance and a specified object are equal.

  • public override int GetHashCode()

    Returns the hash code for this instance.

  • public override string ToString()

    Returns the fully qualified type name of this instance.

  • public string ToString(string? format, IFormatProvider? formatProvider)

    Formats the value of the current instance using the specified format.

  • public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default(ReadOnlySpan<char>), IFormatProvider? provider = null)

    Tries to format the value of the current instance into the provided span of characters.

Used by (10)

  • AlgebraicPropertyTestsVixen.Core.Mathematics.Tests
  • EffectLoaderVixen.Shaders
  • GeneratedBindingsTestsVixen.Shaders.Tests
  • LightingConstantsVixen.Shaders.Tests
  • LightingKeysVixen.Shaders.Tests
  • ShaderConstantsVixen.Shaders
  • TransformTestsVixen.Core.Mathematics.Tests
  • TypeRegistrationVixen.Core.Mathematics
  • VectorTestsVixen.Core.Mathematics.Tests
  • Vixen_Core_Mathematics_Matrix3x3SerializerVixen.Core.Mathematics