CultMath: clamp_twist's NaN guard is one post-wrap check
All checks were successful
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Successful in 28m39s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-27 22:18:29 +01:00
commit e2afa3f31b

View file

@ -110,7 +110,6 @@ public static partial class math
public static quaternion clamp_twist(quaternion twist, float3 unitAxis, float min, float max)
{
var angle = 2.0f * atan2(dot(vec(twist), unitAxis), twist.w);
if (float.IsNaN(angle) || float.IsNaN(min) || float.IsNaN(max)) return new quaternion(float.NaN, float.NaN, float.NaN, float.NaN);
const float pi = MathF.PI;
if (max - min >= 2.0f * pi) return twist;
var centre = 0.5f * (min + max);