code wiki / _hdl_build / nx_viz_zoom.nx

nx_viz_zoom.nx

buildroot/runtime/_hdl_build/nx_viz_zoom.nx

1208 B21 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind tooltopic viz
docsdependenciesstructsconstsfunctions

about

nx_viz_zoom.nx -- the ZOOM math core of the sovereign Nishi viz library's INTERACTION layer (the d3-zoom transform, bits-up). Transform state st[0]=k (scale, permil 1000=1x), st[1]=tx, st[2]=ty. screen = data*k/1000+t. Zooming by factor f around screen point (px,py) keeps the data point under the cursor FIXED (the d3-zoom invariant). Pure integer -> emits cleanly to WASM (nx_wat_compiler) for in-browser pan/zoom. Closes interact-zoom (math). license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_viz_zoom.nx nx_viz_zoom_gate.nx

imports: nx_syscalls.nx

imported by: nx_viz_zoom_gate.nx

structs

none

consts

none

functions

9func vz_zoom(st: *i64, px: i64, py: i64, f: i64) -> i64
called by 1: main
17func vz_pan(st: *i64, dx: i64, dy: i64) -> i64 { st[1] = st[1] + dx; st[2] = st[2] + dy; return 0 }
called by 1: main
19func vz_apply_x(st: *i64, dx: i64) -> i64 { return dx * st[0] / 1000 + st[1] }
called by 1: main
20func vz_apply_y(st: *i64, dy: i64) -> i64 { return dy * st[0] / 1000 + st[2] }
called by 1: main
21func main() -> i64 { return 0 }