All checks were successful
docs / build-and-deploy (push) Successful in 2s
A Noise.* namespace for procedural generation, implemented entirely in Q16.16 fixed point over an integer permutation hash so a seed reproduces the exact same field on every platform and run (native/headless/wasm) — the determinism edge over float noise that drifts across CPUs. - value2 / perlin2 / simplex2 — value, gradient, and simplex noise -> [-1,1] - fbm2(x,y,seed,octaves) — fractal Brownian motion (octaves of simplex) - cellular2 / cellular2_id — Worley F1 distance + nearest-cell id - unit(n) — remap [-1,1] -> [0,1] Covers issue phases 1–2 fully plus cellular from phase 3; domain warp, ridged/ billow, and sample1/sample3 remain as follow-ups. Pure integer IR, C-free; cellular/fbm reuse the math prelude's fx_sqrt. - examples/library/noise.ludic: asserts the invariants a fixed-point generator must hold (Perlin == 0 at lattice points, every sampler within [-1,1], reproducibility, seed sensitivity, non-negative cellular distance). Wired into `x test` (now 52 passed). - docs: a new Noise section + per-symbol pages; inventory and coverage pass. - seed regenerated; `x bootstrap-cfree` fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
997 B
997 B
| id | name | category | kind | tokens | sig | tip | order | ns | member |
|---|---|---|---|---|---|---|---|---|---|
| noise-unit | Noise.unit | noise | namespace-method | Noise.unit | Noise.unit(n) -> fixed | Remap a [-1,1] noise sample to [0,1]. | 7 | Noise | unit |
Remaps a noise sample from [-1, 1] to [0, 1] — literally n / 2 + 0.5 — returning a fixed. The signed range is the natural output of the samplers, but heights, densities, probabilities, and colour ramps usually want the unsigned [0, 1] range; unit is the one-step conversion. It is a plain affine remap, so unit(-1) == 0, unit(0) == 0.5, and unit(1) == 1.
Parameters:
n— a sample in[-1, 1](e.g. fromperlin2/simplex2/fbm2)
program Unit {
entry {
let n = Noise.simplex2(fixed(1) / fixed(2), fixed(1) / fixed(2), 1337)
let height = Math.floor(Noise.unit(n) * fixed(64)) # 0..64 tiles
print(height)
}
}