Change an energy in the browser
Edit the safe scalar expression, assemble its sparse Hessian, and export the complete program. This path works from GitHub Pages or a blog iframe.
Begin with forms, d, and ⋆ → Then open the live energy →READER → STUDENT → RESEARCHER → AUTHOR
Begin with a figure that runs on a static blog. Clone the lab only when you want to change its structure. Move into TinyAD and Polyscope when the experiment needs a serious native solver. Publish the validated element program with the result.
CHOOSE THE SMALLEST ENVIRONMENT THAT ANSWERS THE QUESTION
Edit the safe scalar expression, assemble its sparse Hessian, and export the complete program. This path works from GitHub Pages or a blog iframe.
Begin with forms, d, and ⋆ → Then open the live energy →Use this when you want new controls, plots, element kinds, or lessons. The committed Wasm is already present. Open the Direction Field Lab repository ↗
git clone https://github.com/the13fools/direction-field-lab.git
cd direction-field-lab
npm ci
npm run doctor
npm run dev
http://localhost:4173. Node 22+ is the only required runtime for this path.
Copy the deliberately small starter when your method needs arbitrary C++, mesh neighborhoods, or native debugging.
cp -R geometry-processing-starter-kit ../my-geometry-project
cd ../my-geometry-project
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j 4
./build/geometry-processing-starter
THE THREAD THROUGH ALL THREE ENVIRONMENTS
A picture is evidence that something rendered. The shared file records what was optimized: unknown association, target, parameters, local expression, edge connection term, face circulation term, and solver choice.
element-program.json runs in the browser and lives in a share URL.GeneratedElementProgram.hh carries the same terms into TinyAD.generated_element_program.py is a readable Python reference.result@2 carries mesh fields and diagnostics back to the web or Polyscope.{
"unknown": {
"association": "vertex",
"dimension": 2,
"frame": "tangent"
},
"terms": [
"vertex expression",
"edge connection",
"triangle circulation"
],
"solver": "damped sparse Newton"
}
STATIC BY DEFAULT
The browser solver, Wasm kernels, examples, and documentation compile into ordinary files under dist/. Public hosting never receives arbitrary C++ or launches Polyscope.
main.The included workflow verifies the numerical tests and the subpath-safe static build before deployment.
dist/npm ci
npm run check
Configure the host’s output directory as dist. Relative asset URLs allow the lab to live at a domain root or repository subpath.
In the workshop, choose Copy iframe for a live figure and include the full-page link underneath. If the blog sanitizes iframes, use the generated Markdown fallback instead.
Create a publication kit →KNOW THE BOUNDARY
The key distinction: JSON and guided controls supply data to code that is already compiled. The Energy Playground expression uses a separate TypeScript autodiff engine. A C++ callback editor on the static site is a source editor and exporter; its changes execute only after a native or Wasm rebuild.