Refactor and enhance math, memory, and utilities

Refactored `sincos` usage in `quaternion` to use tuple-based
returns for improved readability. Introduced a `random` struct
with methods for generating random values of various types
and dimensions, including ranges and directions. Added a
`DynamicArray` class for dynamic resizing and manipulation
of collections. Enhanced `SlotMap` with new methods for
safe access and updates.

Updated `uint` vector types with `NumericConvertable`
attributes for better type interoperability. Removed the
`MathUtilities` class and refactored `adj` and `adjInverse`
methods for encapsulation. Improved memory management
with `StackAllocator` and `UnsafeArray` enhancements.

Added geometry utilities like `AABB`, `OBB`, `Plane`, and
`SphereBounds` for 3D operations. Updated project
configuration for versioning and NuGet packaging.
Performed general code cleanup, improved validation, and
aligned with modern C# practices.
This commit is contained in:
2025-09-23 22:57:12 +09:00
parent 73a0c6e187
commit ac73e28f26
52 changed files with 3658 additions and 5150 deletions

View File

@@ -3,36 +3,45 @@
namespace Misaki.HighPerformance.Mathematics;
[NumericType(typeof(float), sizeof(float), 2, 1, "global::Misaki.HighPerformance.Mathematics.float")]
[NumericConvertable("(float){v}.{c}", typeof(int2), typeof(uint2), typeof(double2))]
[NumericConvertable("{v}.{c} ? 1.0f : 0.0f", typeof(bool2))]
public partial struct float2
{
}
[NumericType(typeof(float2), sizeof(float), 2, 2, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int2x2), typeof(uint2x2), typeof(double2x2))]
public partial struct float2x2
{
}
[NumericType(typeof(float2), sizeof(float), 2, 3, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int2x3), typeof(uint2x3), typeof(double2x3))]
public partial struct float2x3
{
}
[NumericType(typeof(float2), sizeof(float), 2, 4, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int2x4), typeof(uint2x4), typeof(double2x4))]
public partial struct float2x4
{
}
[NumericType(typeof(float), sizeof(float), 3, 1, "global::Misaki.HighPerformance.Mathematics.float")]
[NumericConvertable("(float){v}.{c}", typeof(int3), typeof(uint3), typeof(double3))]
[NumericConvertable("{v}.{c} ? 1.0f : 0.0f", typeof(bool3))]
public partial struct float3
{
}
[NumericType(typeof(float3), sizeof(float), 3, 2, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int3x2), typeof(uint3x2), typeof(double3x2))]
public partial struct float3x2
{
}
[NumericType(typeof(float3), sizeof(float), 3, 3, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int3x3), typeof(uint3x3), typeof(double3x3))]
public partial struct float3x3
{
public float3x3(quaternion q)
@@ -50,26 +59,32 @@ public partial struct float3x3
}
[NumericType(typeof(float3), sizeof(float), 3, 4, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int3x4), typeof(uint3x4), typeof(double3x4))]
public partial struct float3x4
{
}
[NumericType(typeof(float), sizeof(float), 4, 1, "global::Misaki.HighPerformance.Mathematics.float")]
[NumericConvertable("(float){v}.{c}", typeof(int4), typeof(uint4), typeof(double4))]
[NumericConvertable("{v}.{c} ? 1.0f : 0.0f", typeof(bool4))]
public partial struct float4
{
}
[NumericType(typeof(float4), sizeof(float), 4, 2, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int4x2), typeof(uint4x2), typeof(double4x2))]
public partial struct float4x2
{
}
[NumericType(typeof(float4), sizeof(float), 4, 3, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int4x3), typeof(uint4x3), typeof(double4x3))]
public partial struct float4x3
{
}
[NumericType(typeof(float4), sizeof(float), 4, 4, "global::Misaki.HighPerformance.Mathematics.float", elementType: typeof(float))]
[NumericConvertable("{v}.{c}", typeof(int4x4), typeof(uint4x4), typeof(double4x4))]
public partial struct float4x4
{
}