Move docs/ package mirror into document-navigator plugin
Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# value/value
|
||||
|
||||
<!-- begin:auto-docs -->
|
||||
_(no submodules)_
|
||||
<!-- end:auto-docs -->
|
||||
## Purpose
|
||||
|
||||
The `value` module implements 2D and 3D Value noise — the simplest members of the noise family. At every integer lattice point it stores a random value in `[-1, 1]` and smoothly interpolates between them with the quintic fade curve. Value noise is cheaper to evaluate than Perlin noise (no gradient dot-products) but has a visibly axis-aligned structure; it is most useful as an inexpensive layer inside fBm or as a mask for other effects.
|
||||
|
||||
## Features
|
||||
|
||||
- `ValueNoise` class with reusable seeded permutation table
|
||||
- `value2(seed, x, y)` / `value3(seed, x, y, z)` functional APIs
|
||||
- Output normalised to `[-1, 1]`
|
||||
- Deterministic per seed
|
||||
|
||||
## Usage: Basic Example
|
||||
|
||||
```ts
|
||||
import { value2 } from "@suaveplan/noise";
|
||||
|
||||
const v = value2("layer", 2.5, 4.1);
|
||||
```
|
||||
|
||||
## Usage: Advanced Example
|
||||
|
||||
```ts
|
||||
import { ValueNoise } from "@suaveplan/noise";
|
||||
|
||||
const n = new ValueNoise("rocks");
|
||||
let sum = 0;
|
||||
let weight = 1;
|
||||
for (let o = 0; o < 4; o += 1) {
|
||||
sum += weight * n.noise2(1.3 * o, 2.7 * o);
|
||||
weight *= 0.5;
|
||||
}
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
- `new ValueNoise(seed)` — one seeded permutation table, reusable.
|
||||
- `noise2(x, y)` / `noise3(x, y, z)`.
|
||||
- `value2(seed, x, y)` / `value3(seed, x, y, z)` — functional helpers.
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
The per-lattice-point value is derived from the 256-byte permutation table by reading `perm[(perm[xi] + yi) & 0x1ff]` and rescaling from `[0, 255]` to `[-1, 1]`. Quintic fade keeps the output C² continuous at lattice boundaries, matching the smoothness of our Perlin implementation.
|
||||
|
||||
### Algorithm
|
||||
|
||||
Value noise samples a lattice of pseudo-random values derived from the seed and interpolates with a quintic smoothstep (`6t^5 - 15t^4 + 10t^3`) for continuous first and second derivatives. Cheaper than gradient noise but produces a more block-like visual character — good for low-frequency base layers in a multi-octave stack. The permutation table is identical to the one used by `simplex` so both generators share a single precomputed lookup.
|
||||
Reference in New Issue
Block a user