Skip to main content

attractor_budget

Function attractor_budget 

Source
pub fn attractor_budget(anchor: u32, target_px: u32, ceiling: u32) -> u32
Expand description

The attractor’s drawn sample budget for a target of target_px pixels, before a preset’s [particles] density narrows it further (ADR-0140).

clamp(round(anchor * target_px / REFERENCE_PX), anchor, ceiling).

The lower clamp is load-bearing. The law can only ever add samples above REFERENCE_PX, never remove them below it, so every existing capture — the 128x128 golden suite, the 96x96 sanity suite, every small shot still — resolves to exactly the count it resolved before this function existed and stays byte-identical. That is assertable on the value rather than inferred from pixels, which is the same shape of argument ADR-0065 used for deposit_scale being exactly 1.0 at Floor.

f64 throughout: anchor * target_px reaches 41 bits at a 4K target, past f32’s 24-bit mantissa, so the product would be rounded before the divide.

A ceiling below anchor is raised to it rather than inverting the clamp — u32::clamp panics when min > max, and this runs on the resize path.