v0.1.0 — Section 6.3 boundary-weight cascade is live

Trace-preservingfinite-element projections

A small, dependency-free JavaScript reference implementation of Π⁰, Π¹, Π², Π³ for the 3D de Rham complex. Bounded, commuting, exact on the boundary. Built for engineers who care about the math.

Runtime deps
0
Pure ESM kernel
Form degrees
4
Π⁰ · Π¹ · Π² · Π³
Point location
O(log N)
Balanced AABB
License
MIT
Open source

Capabilities

Everything you need to project onto the discrete de Rham complex.

One library. Four form degrees. Three trace spaces. Zero transpilation. The same code runs in Node 24+, the browser, and the sandboxed playground.

Core

Full 3D de Rham complex

Π⁰ over H¹, Π¹ over H(curl), Π² over H(div), Π³ over L². The complete discrete de Rham complex, lowest order, lowest friction.

Verified by 192 unit tests
Section 6.3

Exact boundary traces

Vertex values u(v), edge tangentials ∫_e u·t ds, and face normal fluxes ∫_f u·n dA reproduced to machine precision on every boundary simplex.

Verified by 192 unit tests
Weights

Boundary weight cascade

Vertex, edge, and face duality functionals on P¹, N₀, and RT₀, built from the barycenter tent μ and the local mass matrix on each star.

Verified by 192 unit tests
Kernel

Zero runtime dependencies

LU solve, 3×3 inverse, barycentric gradients, surface differential operators — every kernel routine is hand-rolled in pure JavaScript.

Hot-path code paths. Sub-millisecond per projection on 10k tetrahedra.

Performance

AABB point location

O(log N) point-in-tet queries after a one-time balanced tree build. Pick any point inside the unit cube and get the projected value in microseconds.

Verified by 192 unit tests
Extensibility

Higher-order enrichment

Scalar bubble basis for H¹ (p ≥ 4) and an L² monomial basis for L² (p ≥ 1). Hand-written .d.ts for every module.

Verified by 192 unit tests

Get started

One npm install,
then the API is the math.

No build step. No transpiler. No peer-dep negotiation. Drop the lib into any Node 24+ project and call projectH1, projectHcurl, or projectHdiv — the rest of the de Rham complex is just composition.

  • Pure ESM, ES2024 syntax — no Babel, no SWC
  • CJS and UMD bundles ship on npm
  • Hand-written .d.ts for every module
  • Runs in the browser via the UMD bundle on jsDelivr
terminal
01# Node 24+ (Node 26 recommended)
02npm install traceprojector

Architecture

Built on a clean decomposition.

Every projector splits into a boundary-preserving part and an interior ring part. Both are computed in stable local solves on Alfeld- or Worsey–Farin-subdivided patches — no global system, no iterative refinement.

The master equation

Πˡ=Π_∂ˡ+Π_ringˡ·(I − Π_∂ˡ)

Π_∂ˡ prescribes the boundary data exactly. Π_ringˡ is the interior projector with vanishing trace. Together they form a single, commuting, bounded operator.

Π_∂ˡ

Boundary projector

Prescribes the boundary data exactly. Built on Alfeld (boundary faces) or Worsey–Farin (bulk tet) splits.

Π_ringˡ

Interior projector

Stable local problem with vanishing trace on the boundary. Decouples from boundary geometry.

Boundary weight cascade
ζ⁰₀,ᵥ on

eq. 6.25 — vertex scalar duality

ζ¹₀,ₑ on N₀

eq. 6.31 — Whitney edge tangential

ζ²₀,ƒ on RT₀

eq. 6.36 — Raviart–Thomas face flux

Commuting diagram
grad Π⁰ = Π¹ grad
curl Π¹ = Π² curl
div Π² = Π³ div

The discrete operators {grad, curl, div} and the projectors {Π⁰, Π¹, Π², Π³} commute term-by-term on every mesh.

Algorithm and analysis from Ern, Guzmán, Potu (2026) — arXiv:2604.28103.

Live in browser

Pick a function.
Watch the projector do the math.

The bundled playground runs the full library in your browser. Rotate the mesh, change the function, change the form degree, and watch the L² error converge as you refine the mesh.

3D tetrahedral viewer

Inspect the projected field on a live rotating mesh.

Five canonical test functions

Sincos, quadratic, linear, trig, exponential.

Convergence plot

L² error vs. mesh size, h = 1/n on the unit cube.

Open the full playgroundNo install. Runs entirely in your browser.
traceprojector / playground
u(x, y, z) = sin(x) cos(y) e^z
Building tetrahedral mesh…
Drag to rotate · Scroll to zoom

API surface

Six methods.
Four form degrees.

The whole public surface fits on a postcard. No event emitters, no stream lifecycle, no hidden state — every call is deterministic and side-effect-free.

Read the full API reference
new Projector(mesh, whitney, opts)

Orchestrates the four form-degree projectors and precomputes everything you need.

projector.projectH1(u, point, p)

Project onto P¹ at any point inside the unit cube. Returns the scalar field value.

projector.projectHcurl(u, point, p)

Project onto the Nédélec edge element space. Returns a 3-vector field.

projector.projectHdiv(u, point, p)

Project onto the Raviart–Thomas face element space. Returns a 3-vector field.

projector.projectL2(u, point, p)

Project onto cell-wise constants. Bounded in L² norm.

projector.projectAtPoint(u, point, p)

Project at any 3D point. AABB point location handled internally.

By the numbers

Small surface. Honest numbers.

Everything you need to evaluate traceprojector before you import it. No marketing gymnastics, no inflated benchmarks.

192tests

Passing test cases

Mocha + Chai across the full surface

0deps

Runtime dependencies

Hand-rolled linear-algebra kernel

O(log N)per query

Point-in-tet lookup

Balanced AABB tree

l = 0,1,2,3form degrees

Discrete de Rham complex

Π⁰ · Π¹ · Π² · Π³

MIT licensed · Open source · v0.1.0

Ready to project?

Spin up the playground, pick a function, and watch the trace projectors do their thing on a live tetrahedral mesh — all in your browser, no install required.

npm install traceprojector