diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 10:08:22 +0100 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 10:08:28 +0100 |
| commit | 912a2d0b15b873923698126ac8112d1aa4bdbb1a (patch) | |
| tree | ce3e204e6636ce49044c85f7ced1553a399b79e1 /crates/gipfel-wasm/demo/index.html | |
| parent | 6e38ef31467a85edc2aff0a1b6889a417f5ef20f (diff) | |
wasm: experimental browser spike
Proves the gipfel core can run in the browser via WASM. Enabled by the
earlier GSL removal: the core is now pure Rust.
gipfel-core gains byte-oriented entry points (no filesystem) alongside
the existing path-based ones:
- hill::load_from_bytes, Panorama::load_data_from_bytes
- metadata: load_image_from_bytes, read_jpeg_comment_from_bytes,
write_jpeg_comment_to_bytes, save_image_to_bytes (EXIF via Cursor)
New crate gipfel-wasm (experimental, not shipped with the app):
- wasm-bindgen surface: version() + fit_demo(db_bytes, jpg_bytes)
which runs the whole pipeline in memory: parse hill DB, read gipfel
JPEG comment / EXIF, synthesize 5 observations from visible hills,
perturb, refit (pure-Rust LM), report JSON with reprojection error
- demo/index.html: file pickers + result pane (wasm-pack --target web)
- build.sh: adds the wasm target, builds with wasm-pack, prints serve cmd
- native test runs the same pipeline against gipfel.dat + test.jpg and
asserts sub-pixel reprojection error (passes here)
To try on a machine with rustup:
cd crates/gipfel-wasm && ./build.sh
Diffstat (limited to 'crates/gipfel-wasm/demo/index.html')
| -rw-r--r-- | crates/gipfel-wasm/demo/index.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/crates/gipfel-wasm/demo/index.html b/crates/gipfel-wasm/demo/index.html new file mode 100644 index 0000000..f8e764d --- /dev/null +++ b/crates/gipfel-wasm/demo/index.html @@ -0,0 +1,39 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8" /> + <title>gipfel WASM spike</title> + <style> + body { font-family: system-ui, sans-serif; max-width: 720px; margin: 3em auto; line-height: 1.5; } + pre { background: #f4f4f4; padding: 1em; overflow-x: auto; } + label { display: block; margin: 0.6em 0; } + button { margin-top: 1em; padding: 0.5em 1.2em; } + </style> +</head> +<body> + <h1>gipfel WASM spike</h1> + <p>core version: <code id="ver">loading…</code></p> + <p>Pick a hill database and a JPEG (ideally one saved by gipfel, or with EXIF GPS data):</p> + <label>gipfel.dat: <input type="file" id="db" /></label> + <label>image.jpg: <input type="file" id="jpg" /></label> + <button id="go" disabled>Run fit pipeline</button> + <pre id="out">pick both files, then run</pre> + + <script type="module"> + import init, { fit_demo, version } from '../pkg/gipfel_wasm.js'; + const $ = (id) => document.getElementById(id); + await init(); + $('ver').textContent = version(); + $('go').disabled = false; + $('go').onclick = async () => { + const f = (id) => $(id).files[0]; + if (!f('db') || !f('jpg')) { $('out').textContent = 'pick both files first'; return; } + const db = new Uint8Array(await f('db').arrayBuffer()); + const jpg = new Uint8Array(await f('jpg').arrayBuffer()); + const t0 = performance.now(); + const res = fit_demo(db, jpg); + $('out').textContent = res + `\n\n(wall time: ${(performance.now() - t0).toFixed(1)} ms)`; + }; + </script> +</body> +</html> |
