using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; namespace StgSharp.Math { [StructLayout(LayoutKind.Explicit)] public struct Matrix4x3:IEquatable { [FieldOffset(0)] public Vec3D row1; [FieldOffset(12)] public Vec3D row2; [FieldOffset(24)] public Vec3D row3; [FieldOffset(36)] public Vec3D row4; public Matrix4x3( float a11, float a12, float a13, float a21, float a22, float a23, float a31, float a32, float a33, float a41, float a42, float a43 ) { row1 = new Vec3D(a11, a12, a13); row2 = new Vec3D(a21, a22, a23); row3 = new Vec3D(a31, a32, a33); row4 = new Vec3D(a41, a42, a43); } public override bool Equals(object obj) { if (obj == null) { return false; } else if (obj.GetType() != typeof(Matrix4x3)) { return false; } else { return this.Equals((Matrix4x3)obj); } } bool IEquatable.Equals(Matrix4x3 other) { if (this.GetHashCode() != other.GetHashCode()) { return false; } else { return this.row1 == other.row1 && this.row2 == other.row2 && this.row3 == other.row3 && this.row4 == other.row4; } } public override int GetHashCode() { return base.GetHashCode(); } public override string ToString() { return base.ToString(); } } }