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

@ -488,6 +488,18 @@ public sealed class SiteCellsTests
Assert.Equal(new float2(4.0f, 0.0f), segment_closest(new float2(9.0f, 3.0f), new float2(0.0f, 0.0f), new float2(4.0f, 0.0f)));
}
[Fact]
public void PowerBorderStepOutsideTheOwnersCellReportsDistanceZeroWithThatPlanesNormal()
{
var left = new float4(0.0f, 0.0f, 0.0f, 1.0f);
var right = new float4(4.0f, 0.0f, 0.0f, 1.0f);
var empty = new float4(0.0f, 0.0f, 0.0f, 1.0e30f);
var inside = power_border_step(new float3(1.0f, 0.0f, 0.0f), left, right, empty);
Assert.Equal(new float4(-1.0f, 0.0f, 0.0f, 1.0f), inside);
var outside = power_border_step(new float3(3.5f, 0.0f, 0.0f), left, right, empty);
Assert.Equal(new float4(-1.0f, 0.0f, 0.0f, 0.0f), outside);
}
[Fact]
public void PowerBorderStepLeavesTheBorderAloneForASiteCoincidentWithTheOwner()
{