CultMath sites: exact power cell border (radical planes, midpoint form), validated cell spans, one shader name per segment function
power_border_step/power_border give the exact distance to the owner's power cell boundary: the least radical-plane distance over every other site, built from the offset and (w1-w2)(w1+w2) so it does not cancel. site_cells_border is documented as the two-winner bisector distance. Cell spans refuse non-finite positions, queries and spans over 2^24. segment_closest is public in C#; the HLSL segment functions are 3D only (no new overload sets). Tests added. Does not build the GLSL checks: CultMath.glsl and glsl-parity.json are regenerated in the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ee8b15ec2c
commit
bcd8a58055
9 changed files with 304 additions and 69 deletions
|
|
@ -330,7 +330,8 @@ public static partial class math
|
|||
public static float distance_to_segment(float3 point, float3 start, float3 end) =>
|
||||
distance(point, segment_closest(point, start, end));
|
||||
|
||||
private static float2 segment_closest(float2 point_value, float2 start, float2 end)
|
||||
/// <summary>The point of the segment <paramref name="start"/>-<paramref name="end"/> nearest <paramref name="point_value"/>; a degenerate segment is its start.</summary>
|
||||
public static float2 segment_closest(float2 point_value, float2 start, float2 end)
|
||||
{
|
||||
var segment = end - start;
|
||||
var segmentLengthSq = lengthsq(segment);
|
||||
|
|
@ -341,7 +342,8 @@ public static partial class math
|
|||
return start + segment * t;
|
||||
}
|
||||
|
||||
private static float3 segment_closest(float3 point_value, float3 start, float3 end)
|
||||
/// <summary>The point of the segment <paramref name="start"/>-<paramref name="end"/> nearest <paramref name="point_value"/>; a degenerate segment is its start.</summary>
|
||||
public static float3 segment_closest(float3 point_value, float3 start, float3 end)
|
||||
{
|
||||
var segment = end - start;
|
||||
var segmentLengthSq = lengthsq(segment);
|
||||
|
|
|
|||
Loading…
Reference in a new issue