1# Interactive surface mesh refinement
3Runs in your browser through [numbl](https://numbl.org) — no install.
5## ▶ [Open `refine_demo.m`](refine_demo.m) and click **Run**
7A cubed-sphere [surfacefun](https://github.com/danfortunato/surfacefun) mesh
8appears in the figure. Drag the **Refinement level** slider: the page sends the
9level back to the script, which refines the mesh with surfacefun and returns the
10new patches — the surface re-renders in place (drag to rotate, scroll to zoom).
12It's a live demo of numbl's `uihtml` two-way bridge: data flows script → figure,
13and the slider drives work back in the interpreter, figure → script.
15## How it works
17- [`refine_demo.m`](refine_demo.m) — loads surfacefun via `mip`, builds the base
18 mesh, sends it to the figure, and refines on demand in its
19 `HTMLEventReceivedFcn` callback.
20- `app/` — a small React/three.js app (built to a single HTML file) that renders
21 the surface with numbl's own surface renderer and hosts the slider.
23On every push to `main`, the
24[deploy workflow](.github/workflows/deploy.yml) builds the app, bundles the
25project with the numbl browser IDE, and publishes it to GitHub Pages.