daily update on 20230309 by nitload youmu

This commit is contained in:
Nitload
2023-03-10 01:57:31 +08:00
parent 11cdd85b3b
commit 561196bed2
53 changed files with 1491 additions and 360 deletions
+25 -15
View File
@@ -21,6 +21,18 @@ namespace StgSharp.Math
row2= r2;
row3= r3;
}
public Matrix3x2(
float a11, float a12,
float a21, float a22,
float a31, float a32
)
{
row1 = new Vec2D(a11, a12);
row2 = new Vec2D(a21, a22);
row3 = new Vec2D(a31, a32);
}
bool IEquatable<Matrix3x2>.Equals(Matrix3x2 other)
{
if (this.GetHashCode() != other.GetHashCode())
@@ -63,23 +75,21 @@ namespace StgSharp.Math
return $"{row1}\n{row2}\n{row3}";
}
public static unsafe Matrix3x3 operator *(Matrix3x2 array1, Matrix3x2 array2)
public static Matrix3x2 operator +(Matrix3x2 matrix1, Matrix3x2 matrix2)
{
float* p1 = &array1.row1.X;
float* p2 = &array2.row2.X;
return new Matrix3x2(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2,
matrix1.row3 + matrix2.row3
);
}
Matrix2x2 a11 = new Matrix2x2();
return new Matrix3x3(
*(p1 + 0) * *(p2 + 0) + *(p1 + 1) * *(p2 + 3),
*(p1 + 0) * *(p2 + 1) + *(p1 + 1) * *(p2 + 4),
*(p1 + 0) * *(p2 + 2) + *(p1 + 1) * *(p2 + 5),
*(p1 + 2) * *(p2 + 0) + *(p1 + 3) * *(p2 + 3),
*(p1 + 2) * *(p2 + 1) + *(p1 + 3) * *(p2 + 4),
*(p1 + 2) * *(p2 + 2) + *(p1 + 3) * *(p2 + 5),
*(p1 + 4) * *(p2 + 0) + *(p1 + 5) * *(p2 + 3),
*(p1 + 4) * *(p2 + 1) + *(p1 + 5) * *(p2 + 4),
*(p1 + 4) * *(p2 + 2) + *(p1 + 5) * *(p2 + 5)
public static Matrix3x2 operator -(Matrix3x2 matrix1, Matrix3x2 matrix2)
{
return new Matrix3x2(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2,
matrix1.row3 - matrix2.row3
);
}