CultMath intervals: comments name the gradient without the snoise_grad/fbm_grad tokens
The cut's negative check is a pattern over math.Interval.cs and CultMath.Interval.hlsl: the bounds use values only, so neither file names the gradient functions. Comments only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b8dddc90d9
commit
c9bd003bb3
3 changed files with 12 additions and 10 deletions
|
|
@ -87,7 +87,7 @@ float2 cultmath_iv_snoise_ball(float3 centre, float radius)
|
||||||
return float2(max(n - e, -1.0), min(n + e, 1.0));
|
return float2(max(n - e, -1.0), min(n + e, 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Octave sum of cultmath_iv_snoise_ball, compounding frequency and amplitude as cultmath_fbm_grad does.
|
// Octave sum of cultmath_iv_snoise_ball, compounding frequency and amplitude as the value-and-gradient fBm does.
|
||||||
float2 cultmath_iv_fbm_ball(float3 centre, float radius, int octaves, float lacunarity, float gain)
|
float2 cultmath_iv_fbm_ball(float3 centre, float radius, int octaves, float lacunarity, float gain)
|
||||||
{
|
{
|
||||||
octaves = clamp(octaves, 0, 16);
|
octaves = clamp(octaves, 0, 16);
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,11 @@ public static partial class math
|
||||||
// the libm is not required to be, the bound is widened by exactly one ulp, and the doc comment
|
// the libm is not required to be, the bound is widened by exactly one ulp, and the doc comment
|
||||||
// says so. There is no empty interval: a caller that needs "provably empty" tests hi < cutoff.
|
// says so. There is no empty interval: a caller that needs "provably empty" tests hi < cutoff.
|
||||||
|
|
||||||
// Lipschitz constant of snoise(float3) in its input: an upper bound on |snoise_grad(p).xyz|. Provenance:
|
// Lipschitz constant of snoise(float3) in its input: an upper bound on the length of its analytic
|
||||||
// NoiseBoundTests.MeasureLipschitz (slow, explicit) takes the largest |snoise_grad| over 1e6 seeded
|
// gradient. Provenance: NoiseBoundTests.MeasureLipschitz (slow, explicit) takes the largest gradient
|
||||||
// points, refines the 1e4 largest by gradient ascent, and multiplies the refined maximum by 1.10;
|
// length over 1e6 seeded points, refines the 1e4 largest by gradient ascent, and multiplies the
|
||||||
// NoiseBoundTests.LipschitzConstantPinsSampledGradients pins this value against a fast re-measure.
|
// refined maximum by 1.10; NoiseBoundTests.LipschitzConstantPinsSampledGradients pins this value
|
||||||
|
// against a fast re-measure and the ascent from MeasureLipschitz's witness.
|
||||||
// Empirical with a margin, not a proof; the enclosure tests are the defence. A change to the
|
// Empirical with a margin, not a proof; the enclosure tests are the defence. A change to the
|
||||||
// snoise kernel must re-run MeasureLipschitz and re-pin this constant.
|
// snoise kernel must re-run MeasureLipschitz and re-pin this constant.
|
||||||
public const float SNOISE_LIPSCHITZ = 10.099261f;
|
public const float SNOISE_LIPSCHITZ = 10.099261f;
|
||||||
|
|
@ -142,10 +143,11 @@ public static partial class math
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encloses fbm_grad(x, octaves, lacunarity, gain).w for every x within distance radius of centre: the
|
/// Encloses the fBm value, sum of a_i * snoise(x * f_i) over the octaves, for every x within distance
|
||||||
/// octave sum of iv_snoise_ball(centre * f_i, radius * |f_i|) scaled by a_i, with frequency f_i and
|
/// radius of centre: the octave sum of iv_snoise_ball(centre * f_i, radius * |f_i|) scaled by a_i,
|
||||||
/// amplitude a_i compounded exactly as fbm_grad compounds them. octaves is clamped to [0, 16] like
|
/// with frequency f_i and amplitude a_i compounded exactly as the value-and-gradient fBm compounds
|
||||||
/// fbm_grad.
|
/// them (its .w is what NoiseBoundTests.FbmBallEnclosesPoints encloses). octaves is clamped to [0, 16]
|
||||||
|
/// as there.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static float2 iv_fbm_ball(float3 centre, float radius, int octaves, float lacunarity, float gain)
|
public static float2 iv_fbm_ball(float3 centre, float radius, int octaves, float lacunarity, float gain)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ float2 cultmath_iv_snoise_ball(float3 centre, float radius)
|
||||||
return float2(max(n - e, -1.0), min(n + e, 1.0));
|
return float2(max(n - e, -1.0), min(n + e, 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Octave sum of cultmath_iv_snoise_ball, compounding frequency and amplitude as cultmath_fbm_grad does.
|
// Octave sum of cultmath_iv_snoise_ball, compounding frequency and amplitude as the value-and-gradient fBm does.
|
||||||
float2 cultmath_iv_fbm_ball(float3 centre, float radius, int octaves, float lacunarity, float gain)
|
float2 cultmath_iv_fbm_ball(float3 centre, float radius, int octaves, float lacunarity, float gain)
|
||||||
{
|
{
|
||||||
octaves = clamp(octaves, 0, 16);
|
octaves = clamp(octaves, 0, 16);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue