Skip to main content

pattern_positions

Function pattern_positions 

Source
pub fn pattern_positions(p: PatternLayout<'_>) -> Vec<(f64, f64)>
Expand description

Compute deterministic instance offsets relative to the pattern bounds origin.

Returns a Vec<(f64, f64)> of (ox, oy) values, each in the range [0, bounds_w) × [0, bounds_h) for scatter, or spanning the lattice for grid (jitter may push a cell slightly outside the lattice but the clip in the caller handles that). The caller adds the absolute bounds origin (bx, by) to each offset before use.

Ordering:

  • grid: row-major — (col=0,row=0), (col=1,row=0), …, then next row.
  • scatter: ascending i from 0 to count-1.

Pure: no side effects, no randomness, no time, no allocations beyond the returned Vec.