// - edit Matrix.tt to modify #nullable enable namespace Brutal.Numerics; /// /// Implements a 3x2 matrix with double components. /// [DebuggerTypeProxy(typeof(DebugView))] public partial struct double3x2 : IMatrix , IFloatingMatrix3x2 { internal class DebugView(double3x2 m) { public double2 X => m.X; public double2 Y => m.Y; public double2 Z => m.Z; } /// The first row of the matrix. [XmlIgnore] public double2 X; /// The second row of the matrix. [XmlIgnore] public double2 Y; /// The third row of the matrix. [XmlIgnore] public double2 Z; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public double3x2( double m11, double m12, double m21, double m22, double m31, double m32 ) { X = new double2(m11, m12); Y = new double2(m21, m22); Z = new double2(m31, m32); } /// Creates a matrix from the leading 6 elements of a span, row by row. /// The elements to read; must contain at least 6, and any beyond that are ignored. /// holds fewer than 6 elements. [MethodImpl(MethodImplOptions.AggressiveInlining)] public double3x2(ReadOnlySpan span) { if (span.Length < 6) throw new ArgumentOutOfRangeException(nameof(span), "Length must be at least 6."); this = Unsafe.ReadUnaligned(ref Unsafe.As(ref MemoryMarshal.GetReference(span))); } static double3x2 IMatrix.Create(ReadOnlySpan span) => new(span); /// public static double3x2 Identity { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { double3x2 result; result.X = double2.UnitX; result.Y = double2.UnitY; result.Z = double2.Zero; return result; } } /// public static int ComponentSize => sizeof(double); /// public static int RowCount => 3; /// public static int ColumnCount => 2; /// public readonly bool IsIdentity { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => X == double2.UnitX && Y == double2.UnitY && Z == double2.Zero; } }