refactor: primitives now use Core.Math for math

This commit is contained in:
2025-05-02 18:57:42 +03:00
parent 16e4077d40
commit 5de08b8fe4
8 changed files with 22 additions and 37 deletions

View File

@@ -1,5 +1,3 @@
using System;
namespace Syntriax.Engine.Core;
/// <summary>
@@ -178,11 +176,11 @@ public readonly struct Quaternion(float x, float y, float z, float w)
if (dot > 0.9995f)
return Lerp(from, to, t);
float angle = MathF.Acos(dot);
float sinAngle = MathF.Sin(angle);
float angle = Math.Acos(dot);
float sinAngle = Math.Sin(angle);
float fromWeight = MathF.Sin((1f - t) * angle) / sinAngle;
float toWeight = MathF.Sin(t * angle) / sinAngle;
float fromWeight = Math.Sin((1f - t) * angle) / sinAngle;
float toWeight = Math.Sin(t * angle) / sinAngle;
return from * fromWeight + to * toWeight;
}
@@ -213,8 +211,8 @@ public readonly struct Quaternion(float x, float y, float z, float w)
public static Quaternion FromAxisAngle(Vector3D axis, float angle)
{
float halfAngle = angle * .5f;
float sinHalf = MathF.Sin(halfAngle);
return new Quaternion(axis.X * sinHalf, axis.Y * sinHalf, axis.Z * sinHalf, MathF.Cos(halfAngle));
float sinHalf = Math.Sin(halfAngle);
return new Quaternion(axis.X * sinHalf, axis.Y * sinHalf, axis.Z * sinHalf, Math.Cos(halfAngle));
}
/// <summary>
@@ -301,7 +299,7 @@ public readonly struct Quaternion(float x, float y, float z, float w)
/// Generates a hash code for the <see cref="Quaternion"/>.
/// </summary>
/// <returns>A hash code for the <see cref="Quaternion"/>.</returns>
public override int GetHashCode() => HashCode.Combine(X, Y, Z);
public override int GetHashCode() => System.HashCode.Combine(X, Y, Z);
}
/// <summary>