Daily update on 20230803 by nitload youmu, problem of parameter displacement solved, rewriting other linear math

This commit is contained in:
Nitload
2023-08-03 22:46:16 +08:00
parent 194d65edf6
commit aae7e0292c
105 changed files with 13858 additions and 11394 deletions
@@ -1,8 +1,30 @@
namespace StgSharp.Math
using System;
namespace StgSharp.Math
{
public static unsafe partial class VectorCalc
{
public static unsafe float Multiple(Vec3d vec1, Vec4d vec2)
{
M128* retPtr = (M128*)internalIO.mulps_internal(vec1._m128Ptr,vec2._m128Ptr);
return
retPtr->single_0 +
retPtr->single_1 +
retPtr->single_2;
}
public static unsafe float Multiple(Vec4d vec1,Vec4d vec2)
{
M128* retPtr = (M128*)internalIO.mulps_internal(vec1._m128Ptr,vec2._m128Ptr);
return
retPtr->single_0 +
retPtr->single_1 +
retPtr->single_2 +
retPtr->single_3;
}
public static unsafe Matrix4x4 Multiple(
Matrix4x4 matrix1, Matrix4x4 matrix2
)
@@ -74,7 +96,7 @@
);
}
public static float multiple(this vec3d vec, colum3 colum)
public static float multiple(this Vec3d vec, colum3 colum)
{
return vec.X * colum.X + vec.Y * colum.Y + vec.Z * colum.Z;
}
@@ -85,11 +107,11 @@
/// <param name="vec"></param>
/// <param name="matrix"></param>
/// <returns></returns>
public static unsafe vec3d multiple(this vec2d vec, matrix2x3 matrix)
public static unsafe Vec3d multiple(this vec2d vec, matrix2x3 matrix)
{
float* p = &matrix.row1.X;
return new vec3d(
return new Vec3d(
vec.X * *(p + 0) + vec.Y * *(p + 3),
vec.X * *(p + 1) + vec.Y * *(p + 4),
vec.X * *(p + 2) + vec.Y * *(p + 5)