Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 5

- package-ecosystem: cargo
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 5
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.19.0
103 changes: 103 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# prime — Changelog

## 2026-03-29 (all commits)

### Features

- 64-bit PRNG tests + dynamics TS port updates (2257edc)
- **prime-random:** add SplitMix64 (2^64 period) + memoize_1d (969b5de)
- **prime-dynamics:** add numerical calculus + Van der Pol + benchmarks (fe0e102)
- add Criterion benchmarks for prime-dynamics and prime-voronoi (9cfa941)
- **prime-voronoi:** add Bowyer-Watson Delaunay triangulation (3dc27e4)
- **prime-dynamics:** add L-system string rewriting (b6b5060)
- Bridson im::Vector optimization, ADR-006/007, README update (af4c8b2)
- CausalStep<T> type + receiver model docs + ADR-005 (4c6b753)
- WASM bindings for Phase 2-6 + architecture decision records (17e96d9)
- **ts:** Phase 10 — complete batch 3 tests + diffusion PRNG unification (b5be424)
- **ts:** Phase 10 — update TS ports for prime-dynamics, prime-spatial, prime-splines (0f4a784)
- **ts:** Phase 10 — update TS ports for prime-signal, prime-osc, prime-interp (097fa43)
- **ts:** Phase 10 — update TS ports for prime-noise, prime-color, prime-voronoi (28ea695)
- additional Phase 3/5 completions from parallel agents (616d1e7)
- complete Phases 2-6 — add missing ROADMAP functions across 6 crates (c309abf)
- **prime-interp:** add missing Phase 1 functions, complete doc-tests (d1f2c37)
- **prime-random:** add distributions, quasi-random, Monte Carlo, fix Bridson (71dc0e9)
- **prime-wasm:** add WASM bindings for all prime crates + CI job (00a1a34)
- **prime-voronoi:** Voronoi nearest-neighbor, F1/F2 distances, Lloyd relaxation (5313880)
- **prime-diffusion:** Ornstein-Uhlenbeck and geometric Brownian motion (40c54b4)
- **prime-splines:** implement Bezier, Hermite, Catmull-Rom, B-spline, slerp (095db0c)
- **prime-noise:** add 3D noise, simplex, and domain warping (e0b3ec2)
- **prime-dynamics:** implement dynamical systems and numerical integration (fc14b94)
- **prime-render:** pure sample-level scan loop — ADVANCE evaluator (d2abac8)
- **ts-ports:** prime-noise, prime-color, prime-spatial TypeScript ports (fa4605e)
- **prime-spatial:** ray tests, AABB, frustum cull — unblocks Form (91df676)
- **prime-color:** Oklab, sRGB, HSL — pure color math, zero deps (623ff00)
- **prime-noise:** value noise, Perlin, FBM, Worley — pure, zero deps (af47955)
- **prime-osc:** LFO shapes + ADSR envelope — unblocks Score (9671d5f)
- **prime-signal:** smoothdamp, spring, lowpass, highpass, deadzone (563440e)
- **prime-interp:** easing + interpolation — Rust + TS, full test coverage (6f3fffd)
- **prime-random:** pure Mulberry32 — no class, APPEND/ADVANCE only (db0b1be)

### Bug Fixes

- use std::hint::black_box for criterion 0.8, fix clippy in prime-noise (b6f4570)
- **thesis:** self-contained eslint config — no file: dependency (b2420be)
- **prime-random:** noUncheckedIndexedAccess compatibility — non-null assertions + loose null check (cfa3922)
- **thesis:** remove mut params from private helpers hash_u32 and hsl_component (2e16950)
- **prime-voronoi:** fix typecheck error in voronoiF1F2_2d parity test (b35374b)
- **prime-splines:** remove --passWithNoTests from test script (9b024ac)
- vitest --passWithNoTests for stub packages (sdf, splines, voronoi) (537dcc1)
- rng.test.ts prngBool reduce return type annotation (f1ec24a)
- remaining clippy + TS type annotation issues (dddc4a8)
- noise fbm2d callback return type annotation for TS strict overload resolution (14c40fe)
- CI — clippy excessive_precision + map_or + TS Array.from<null> type inference (a7a93a5)

### Performance

- revert im::Vector — Vec clone faster at Bridson grid sizes (68b2bc7)
- **prime-random:** thesis-pure Bridson, add stratified MC integration (b2d8eae)

### Refactoring

- **prime-diffusion:** unify PRNG with prime-random Mulberry32 (1422f59)
- **prime-random:** replace let/while with successors utility in TS Bridson (2af35dd)

### Tests

- add 7 rigorous statistical tests for academic/production standards (75bcbe2)
- add 8 statistical validation tests for thesis proof (517ac99)
- add receiver model golden fixture tests (0f15287)

### Documentation

- **audit:** TS bindings audit + CLAUDE.md ADVANCE-EXCEPTION clarification (d03d8ab)
- update ROADMAP — all PRIME phases complete (9d1d00e)
- add README for release (da11035)
- math reference for prime-splines (cac902d)
- complete math reference for all remaining crates (471d94a)
- math reference for prime-interp, prime-signal, prime-osc (0204555)
- update prime-random benchmarks with post-merge numbers (006630a)
- write prime-random mathematical reference for thesis (16607b8)
- **prime:** document batch publish policy + GitHub dep strategy for consumers (adccecb)

### Chores

- upgrade glam 0.27 → 0.32, criterion 0.5 → 0.8 (998e6b3)
- trim remaining rustdoc bloat on MC and Bridson functions (f08d516)
- trim rustdoc bloat, remove dead deps, update CLAUDE.md (79c9711)
- scrub research language from comments + add NOTICE file (a995f1c)
- migrate thesis enforcement to shared ESLint config (8ce575d)
- add thesis-check CI gate (TS packages) (2e5c8da)
- **polish:** implement prime-sdf TS, add cross-language parity tests, fill coverage gaps (fc6b105)
- full coverage pass — edge cases, WASM gaps, overflow fix (98bbc1d)
- update pnpm lockfile for new packages (fbea8c4)
- gitignore THESIS.md — local only, not ready to publish (701da3e)
- remove stage-* TypeScript packages from prime workspace (fc168b4)
- remove stage-* crate dirs from prime workspace (444f84f)
- temporal assembly vocabulary, workspace tsconfig + pnpm setup (95760c8)
- roadmap, prime-diffusion + prime-dynamics stubs, remove form packages (47600b4)
- initial scaffold — workspace, all crate stubs, TS packages (3003184)

### CI

- trigger CI after retarget to dev (7f08ab5)
- add GitHub Actions workflow — Rust + TypeScript (75e010f)
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ADVANCE ← move forward reduce/fold over time steps
6. **TypeScript: no `let` — use `const` only.** Production code AND tests.
- Fold pattern: `Array.from({ length: N }).reduce((state) => step(state, dt), init)`
- Tuple destructuring `const [a, b] = fn()` threads state explicitly between steps.
- Exceptions: `while` loops in Bridson-class algorithms (stack overflow risk) — mark with `// ADVANCE-EXCEPTION`.
- Exceptions: `while`/`for` loops where termination is data-dependent (Bridson-class algorithms, adaptive ODE solvers, bounded convergence loops like Newton-Raphson and bisection) — mark with `// ADVANCE-EXCEPTION`. Mutation must be local to the function; same inputs always produce the same output.

### Flag these patterns

Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ glam = "0.32"
criterion = { version = "0.8", features = ["html_reports"] }

[workspace.package]
version = "0.1.0"
version = "1.1.1"
edition = "2021"
license = "MIT"
repository = "https://github.com/bwyard/prime"
authors = ["Bree Yard"]
readme = "README.md"

# No unsafe code, no &mut in public API — pure functions throughout.
# CI runs: cargo clippy --workspace -- -D warnings (all lints are errors)
Expand Down
2 changes: 2 additions & 0 deletions crates/prime-color/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
readme = "README.md"
authors.workspace = true
keywords = ["color", "graphics", "oklab", "srgb", "palette"]
categories = ["mathematics", "game-engines"]

Expand Down
37 changes: 37 additions & 0 deletions crates/prime-color/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# prime-color

Color math — perceptual color spaces (Oklab), sRGB, HSL, HSV, palette generation, luminance, and contrast ratio.

Part of the [prime](https://github.com/bwyard/prime) math ecosystem.

## What's inside

- `srgb_to_oklab` / `oklab_to_srgb` — perceptual color space conversion
- `srgb_to_linear` / `linear_to_srgb` — gamma correction
- `srgb_to_hsl` / `hsl_to_srgb` — HSL conversion
- `srgb_to_hsv` / `hsv_to_srgb` — HSV conversion
- `oklab_mix` — perceptually uniform color interpolation
- `luminance` / `contrast_ratio` — WCAG accessibility math
- `palette_complementary` / `palette_triadic` / `palette_analogous` — palette generation

## Usage

```rust
use prime_color::{srgb_to_oklab, oklab_mix, contrast_ratio};

// Convert to Oklab for perceptual operations
let (l, a, b) = srgb_to_oklab(0.8, 0.2, 0.4);

// Perceptually uniform mix — avoids muddy grays in the middle
let (r, g, b) = oklab_mix(0.9, 0.1, 0.1, // red
0.1, 0.1, 0.9, // blue
0.5); // t

// WCAG contrast ratio
let ratio = contrast_ratio(0.0, 0.0, 0.0, // black
1.0, 1.0, 1.0); // white — 21.0
```

## License

MIT
15 changes: 10 additions & 5 deletions crates/prime-diffusion/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
[package]
name = "prime-diffusion"
version.workspace = true
edition.workspace = true
license.workspace = true
name = "prime-diffusion"
description = "Diffusion systems — Gray-Scott reaction-diffusion, cellular automata"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
readme = "README.md"
authors.workspace = true
keywords = ["diffusion", "reaction-diffusion", "cellular-automata", "simulation", "procedural"]
categories = ["mathematics", "game-engines"]

[dependencies]
prime-random = { path = "../prime-random" }
prime-random = { path = "../prime-random", version = "1.1.0" }
31 changes: 31 additions & 0 deletions crates/prime-diffusion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# prime-diffusion

Stochastic diffusion processes — Ornstein-Uhlenbeck and Geometric Brownian Motion, with seeded and unseeded variants.

Part of the [prime](https://github.com/bwyard/prime) math ecosystem.

## What's inside

- `ou_step` / `ou_step_seeded` — Ornstein-Uhlenbeck mean-reverting process
- `gbm_step` / `gbm_step_seeded` — Geometric Brownian Motion

## Usage

```rust
use prime_diffusion::{ou_step_seeded, gbm_step_seeded};

// Ornstein-Uhlenbeck — mean-reverting random walk (useful for AI behavior, price simulation)
// Returns (next_value, next_seed)
let (x_next, seed_next) = ou_step_seeded(x, mu, theta, sigma, dt, seed);

// Geometric Brownian Motion — multiplicative random walk (asset prices, population growth)
let (x_next, seed_next) = gbm_step_seeded(x, mu, sigma, dt, seed);
```

## Design

Seeded variants use `prime-random` to thread noise deterministically. Unseeded variants accept a pre-sampled Wiener increment `w` for integration with external noise sources.

## License

MIT
13 changes: 9 additions & 4 deletions crates/prime-dynamics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
[package]
name = "prime-dynamics"
version.workspace = true
edition.workspace = true
license.workspace = true
name = "prime-dynamics"
description = "Dynamical systems — RK4/RK45, Lorenz, Duffing, L-systems, Newton-Raphson"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
readme = "README.md"
authors.workspace = true
keywords = ["ode", "dynamical-systems", "runge-kutta", "lorenz", "l-systems"]
categories = ["mathematics", "science"]

[dependencies]

Expand Down
41 changes: 41 additions & 0 deletions crates/prime-dynamics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# prime-dynamics

Dynamical systems — ODE solvers (RK4, Euler), chaotic attractors (Lorenz, Rössler, Duffing), population models, L-systems, and numerical differentiation.

Part of the [prime](https://github.com/bwyard/prime) math ecosystem.

## What's inside

**ODE solvers:** `rk4_step` / `rk4_step3` / `euler_step`

**Chaotic systems:** `lorenz_step` / `rossler_step` / `duffing_step`

**Population models:** `lotka_volterra_step` / `sir_step` (predator-prey, epidemic)

**Reaction-diffusion:** `gray_scott_step`

**L-systems:** `lsystem_step` / `lsystem_generate` with `LRule`

**Numerical math:** `derivative` / `derivative2` / `gradient_2d`

**Logistic map:** `logistic`

## Usage

```rust
use prime_dynamics::{rk4_step, lorenz_step, lsystem_generate, LRule};

// Integrate dy/dt = -y using RK4
let y_next = rk4_step(y, t, dt, |y, _t| -y);

// Lorenz attractor — returns (dx, dy, dz)
let (dx, dy, dz) = lorenz_step(x, y, z, sigma, rho, beta, dt);

// L-system plant growth
let rules = vec![LRule { from: 'F', to: "FF+[+F-F-F]-[-F+F+F]".to_string() }];
let result = lsystem_generate("F", &rules, 3);
```

## License

MIT
2 changes: 2 additions & 0 deletions crates/prime-interp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
readme = "README.md"
authors.workspace = true
keywords = ["easing", "interpolation", "animation", "smoothstep", "lerp"]
categories = ["mathematics", "game-engines"]

Expand Down
35 changes: 35 additions & 0 deletions crates/prime-interp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# prime-interp

Interpolation, easing, and remapping. Lerp, smoothstep, and a full easing function library — quad through elastic.

Part of the [prime](https://github.com/bwyard/prime) math ecosystem.

## What's inside

- `lerp` / `lerp_clamped` / `inv_lerp` — linear interpolation
- `remap` — map a value from one range to another
- `smoothstep` / `smootherstep` — Hermite interpolation
- `repeat` / `pingpong` — wrapping and bouncing ranges
- Easing functions: `ease_in/out/in_out` × quad, cubic, quart, quint, sine, expo, circ, back, elastic, bounce

## Usage

```rust
use prime_interp::{lerp, remap, ease_out_cubic, smoothstep};

// Linear interpolation
let mid = lerp(0.0, 10.0, 0.5); // 5.0

// Remap from one range to another
let remapped = remap(0.5, 0.0, 1.0, 100.0, 200.0); // 150.0

// Eased animation progress
let t = ease_out_cubic(0.3); // decelerated

// Smooth threshold
let alpha = smoothstep(0.2, 0.8, 0.5);
```

## License

MIT
2 changes: 1 addition & 1 deletion crates/prime-interp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::f32::consts::PI;
/// # Arguments
/// * `a` - Start value (returned when t = 0.0)
/// * `b` - End value (returned when t = 1.0)
/// * `t` - Interpolation factor. Not clamped — extrapolates outside [0,1].
/// * `t` - Interpolation factor. Not clamped — extrapolates outside \[0,1\].
///
/// # Example
/// ```rust
Expand Down
2 changes: 2 additions & 0 deletions crates/prime-noise/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
readme = "README.md"
authors.workspace = true
keywords = ["noise", "procedural", "graphics", "perlin", "simplex"]
categories = ["mathematics", "game-engines"]

Expand Down
Loading
Loading