daily update on 20230302 by nitload youmu

This commit is contained in:
Nitload
2023-03-03 00:54:59 +08:00
parent bb71567e51
commit df2af2b2d5
37 changed files with 374 additions and 44 deletions
+74
View File
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct Array4x4:IEquatable<Array4x4>
{
[FieldOffset(0)]
public Vec4D row1;
[FieldOffset(16)]
public Vec4D row2;
[FieldOffset(32)]
public Vec4D row3;
[FieldOffset(48)]
public Vec4D row4;
public Array4x4(Vec4D r1, Vec4D r2, Vec4D r3, Vec4D r4)
{
row1 = r1;
row2 = r2;
row3 = r3;
row4 = r4;
}
public Array4x4(
float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24,
float a31, float a32, float a33, float a34,
float a41, float a42, float a43, float a44
)
{
row1 = new Vec4D(a11, a12, a13, a14);
row2 = new Vec4D(a11, a12, a13, a14);
row3 = new Vec4D(a11, a12, a13, a14);
row4 = new Vec4D(a11, a12, a13, a14);
}
public override bool Equals(object obj)
{
return base.Equals(obj);
}
bool IEquatable<Array4x4>.Equals(Array4x4 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 HashCode.Combine(row1, row2, row3, row4);
}
public override string ToString()
{
return $"{this.row1}\n{this.row2}\n{this.row3}\n{this.row4}";
}
}
}