daily update on 20230830

This commit is contained in:
Nitload
2023-08-30 22:49:11 +08:00
parent 1fcbfb972b
commit c6f4b3dd53
55 changed files with 648 additions and 1198 deletions
+37 -15
View File
@@ -3,9 +3,6 @@ using System.Drawing;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -103,7 +100,10 @@ namespace StgSharp.Math
public static unsafe Matrix4x4 operator +(Matrix4x4 left, Matrix4x4 right)
{
return new Matrix4x4(
Mat4.add( right.mat,left.mat)
right.mat.colum0 + left.mat.colum0,
right.mat.colum1 + left.mat.colum1,
right.mat.colum2 + left.mat.colum2,
right.mat.colum3 + left.mat.colum3
);
}
@@ -111,7 +111,10 @@ namespace StgSharp.Math
public static unsafe Matrix4x4 operator -(Matrix4x4 left, Matrix4x4 right)
{
return new Matrix4x4(
Mat4.sub(right.mat, left.mat)
right.mat.colum0-left.mat.colum0,
right.mat.colum1-left.mat.colum1,
right.mat.colum2-left.mat.colum2,
right.mat.colum3-left.mat.colum3
);
}
@@ -196,7 +199,15 @@ namespace StgSharp.Math
);
}
public static bool operator ==(Matrix4x4 left, Matrix4x4 right)
{
return left.Equals(right);
}
public static bool operator !=(Matrix4x4 left, Matrix4x4 right)
{
return !(left == right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe float Det()
@@ -223,21 +234,32 @@ namespace StgSharp.Math
}
}
public override string ToString()
public override bool Equals(object? obj)
{
InternalTranspose();
return
$"{transpose.colum0}\n" +
$"{transpose.colum1}\n" +
$"{transpose.colum2}\n" +
$"{transpose.colum3}";
return obj is Matrix4x4 x && Equals(x);
}
public bool Equals(Matrix4x4 other)
{
throw new NotImplementedException();
return mat.Equals(other.mat);
}
public override int GetHashCode()
{
return HashCode.Combine(
mat.colum0.GetHashCode(),
mat.colum1.GetHashCode(),
mat.colum2.GetHashCode(),
mat.colum3.GetHashCode()
);
}
public override string ToString()
{
InternalTranspose();
return $"{transpose.colum0}{transpose.colum1}{transpose.colum2}{transpose.colum3}";
}
}