Skip to main content

Module ifs

Module ifs 

Source
Expand description

Iterated function systems: the attractor scene’s fifth family (ADR-0075, Plan 0062).

An IFS is the same GPU chaos game the strange-attractor families already run, with a different step: instead of one map iterated by every particle, there are four affine maps and each particle draws one at random every step. The orbit converges onto the system’s attractor — a Barnsley fern, a bare tree, a dragon curve, a Sierpinski triangle, a spiral — rather than onto a strange attractor’s filigree.

What this module owns is the safety property, and it is why the IFS lives in its own file rather than as four more lines of mod.rs. De Jong and Clifford are bounded for any coefficients, so a preset can drive them anywhere; an IFS converges only while every map contracts, and one map past unit operator norm sends every position to infinity and then to NaN, killing the particle buffer for the rest of the session. Everything here is arranged so that cliff is unreachable rather than guarded against — see ADR-0075.

The mechanism is the parameterization. Every map is carried as the singular value decomposition of its linear part, M = R(θ)·diag(sx, sy)·R(φ) with sy signed, because R is an isometry and so contractivity is exactly max(|sx|, |sy|) < 1 — a comparison on two numbers rather than a property of a matrix. Morphing interpolates there (angles cannot affect contractivity, and an interpolated singular value is below 1 because both endpoints are), and the levers are built the same way.

Nothing in this module touches the GPU or a clock. It resolves a figure to a plain 2x3 affine table plus a cumulative probability table, which is what the compute step receives.

Structs§

Affine
One map’s raw affine coefficients: x' = a·x + b·y + e, y' = c·x + d·y + f.
Extent
A sampled bounding box in the figure’s own world units.
FitLut
The framing of a figure pair, sampled over morph once at configure.
IfsMap
One map, decomposed: M = R(θ)·diag(sx, sy)·R(φ), a translation, and a selection probability.
IfsPacked
What the compute step receives: the four linear parts, the four translations packed two per vec4, and the cumulative probabilities the shader compares a unit draw against.
IfsTable
A curated figure, fully resolved: four maps in canonical order — index 0 the trunk or dominant map, 1 the main body, 2 the left branch, 3 the right branch.
Levers
The four audio-driven shape levers (ADR-0075), applied in SVD space.

Enums§

IfsFigure
Which curated figure the IFS draws.

Constants§

FIT_STEPS
Samples in the framing lookup, spanning morph from 0 to 1 inclusive.
MAPS
How many maps every curated table carries.
SIGMA_CEILING
The ceiling every map’s operator norm is held under (ADR-0075).
SKELETON_FLOOR
Floor on the fixed-point set’s diameter (ADR-0088).

Functions§

chaos_extent
A CPU run of the same step the compute shader runs, returning the sampled bounding box of the orbit.
decompose
The singular value decomposition of a 2x2, as (θ, φ, sx, sy) with M = R(θ)·diag(sx, sy)·R(φ) and sy signed.
fit_scale
The world scale that fits a figure of this half-extent inside the frame.
fixed_points
Every map’s fixed point, with the padded slots filled by duplication.
pack
Lay a resolved table out for the uniform, recomposing each map and accumulating the probabilities.
recompose
The inverse of decomposeR(θ)·diag(sx, sy)·R(φ), multiplied out.
resolve
The pure function everything safety-critical lives in — no GPU, no clock, no randomness (ADR-0075).
skeleton_diameter
The diameter of the fixed-point set: max over j, k of ‖pⱼ − pₖ‖.
skeleton_scale
skeleton_diameter held above SKELETON_FLOOR — the scale the GPU normalises a particle’s distance-from-the-skeleton against.