CultMath shaders: restore the float2 segment overloads, sample close distinct sites, document the border step's owner contract

Shader overloads stay native (ruling shader-overloads-stay-native): cultmath_segment_closest and
cultmath_distance_to_segment have float2 and float3 forms again, with mirror asserts and fixture families.
The rejected "avoid overloads" comment and design text are gone. The border step's outside-cell behaviour
(distance 0 with that plane's normal) is documented in C# and the HLSL header and pinned by a test; the mirror
and fixture gain distinct sites closer than 1e-2. GLSL and fixture regenerate in the next commit; this one does
not pass CommittedGlslEqualsLowering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-16 21:01:16 +02:00
commit 16657fa20f
7 changed files with 81 additions and 8 deletions

View file

@ -69,7 +69,9 @@ public static partial class math
// difference (w1 - w2)(w1 + w2), never from a difference of two large squared distances, so it does not
// cancel for a far query or close sites. border is the running (unit normal toward the owner, distance),
// starting at (0, 0, 0, 1.0e30): the cell's boundary distance is the least plane distance over every other
// site. A site coincident with the owner has no plane and leaves border unchanged.
// site. A site coincident with the owner has no plane and leaves border unchanged. The step trusts the caller's
// owner: a p outside the owner's cell has a negative signed distance to some plane, which is clamped to 0, so the
// step reports distance 0 with that plane's normal, a plausible on-the-border answer, not an error.
public static float4 power_border_step(float3 p, float4 owner, float4 other, float4 border)
{
var d = other.xyz - owner.xyz;