method
Noise.cellular2
Noise.cellular2(x, y, seed) -> fixed
Samples **cellular (Worley) noise** at (x, y) and returns the F1 distance — the distance to the nearest feature point — as a fixed (roughly [0, 1.5]). Each lattice cell holds one feature point placed by its hash; scanning the 3×3 neighbourhood finds the closest one. The distance field forms Voronoi cells, which are exactly the structure you want for stone and cracked textures, biome or region boundaries, and scattered-feature layouts. Small distances mark cell centres; ridges appear where two cells meet.
Pair it with Noise.cellular2_id to also know *which* cell you are in. Deterministic in fixed point across platforms and runs.
Parameters
seedthe field selectorExample
program Cellular {
entry {
let seed = 7
let d = Noise.cellular2(fixed(5) / fixed(4), fixed(3) / fixed(4), seed)
print(Math.floor(d * fixed(1000))) # distance to nearest cell point
}
}