CultMath intervals r3: iv_frustum_ball widened by its derived float32 rounding bound; extreme-family enclosure
The radius gains (|c|_1 + radius) 2^-20 in C# and both HLSL copies; the doc's strictness claim leaves. TileBallEnclosesEveryRaySegment measures in double over the r2 domain and seven extreme families with outward corner flows, pins the radius two-sided, and counts misses per family. The noise ball enclosure tests draw radii to 1e3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
43183276d3
commit
5f6bbfd4b5
6 changed files with 173 additions and 56 deletions
|
|
@ -175,16 +175,25 @@ public static partial class math
|
|||
/// pixel footprint, so sub-pixel jitter is covered). The centre is (m_c z_m, z_m), z_m = (z0 + z1) / 2;
|
||||
/// the radius is ((z1 - z0) / 2) |(m_c, 1)| + z1 footprintPerDepth + warp. Derivation: a point of slope
|
||||
/// m_c + e (|e| <= footprintPerDepth) at depth z is c + (z - z_m)(m_c, 1) + z (e, 0); the first term is
|
||||
/// at most the first radius term, the second at most the second, and the warp adds at most warp
|
||||
/// (NoiseBoundTests.TileBallEnclosesEveryRaySegment). The two vectors are never parallel, so the
|
||||
/// triangle inequality is strict. The caller rotates and translates the centre into world space (the
|
||||
/// radius is unchanged) and scales both by its noise frequency.
|
||||
/// at most the first radius term, the second at most the second, and the warp adds at most warp.
|
||||
/// The ball also carries its own float32 rounding: the radius is widened by (|c|_1 + radius) 2^-20.
|
||||
/// With u = 2^-24, each centre component carries at most two roundings (z_m, then the product), so the
|
||||
/// float centre is within 2u |c|_1 of the exact one; the radius carries at most seven, so the exact
|
||||
/// radius is at most (1 + 7u) times the float one; the widening rounds once more. 2^-20 = 16u covers
|
||||
/// 8u (|c|_1 + radius) twice over, and fma contraction only removes roundings. So every exact point of
|
||||
/// every ray, at any depth and slope, lies in the returned float ball
|
||||
/// (NoiseBoundTests.TileBallEnclosesEveryRaySegment, degenerate and far segments included). The caller
|
||||
/// rotates and translates the centre into world space (the radius is unchanged) and scales both by its
|
||||
/// noise frequency; the rounding of that transform is the caller's.
|
||||
/// </summary>
|
||||
public static float4 iv_frustum_ball(float2 centreSlope, float z0, float z1, float footprintPerDepth, float warp)
|
||||
{
|
||||
var zm = (z0 + z1) * 0.5f;
|
||||
var axis = sqrt(centreSlope.x * centreSlope.x + centreSlope.y * centreSlope.y + 1.0f);
|
||||
var cx = centreSlope.x * zm;
|
||||
var cy = centreSlope.y * zm;
|
||||
var radius = (z1 - z0) * 0.5f * axis + z1 * footprintPerDepth + warp;
|
||||
return new float4(centreSlope.x * zm, centreSlope.y * zm, zm, radius);
|
||||
radius += (abs(cx) + abs(cy) + abs(zm) + radius) * 9.5367431640625e-7f;
|
||||
return new float4(cx, cy, zm, radius);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue