How saehm/hagrid works
Hagrid is a TypeScript library for reducing scatterplot overlap: a caller supplies 2D points and selects a layout, then receives distinct grid-cell positions (or, for CMDS, intermediate layouts and a final snapped result). Its principal path is the public API through the method dispatcher into one of seven techniques. The README documents all seven methods and their differing coordinate spaces. The dispatcher’s imports and calls are visible; utility use is supported by the source index. Other implementation details were not sampled, so no further internal links are inferred.
Main entry points: gridify.ts Layout dispatcher · utils.ts Geometry utilities · main.ts Public exports · hilbert.ts Hilbert curve
Components 13
Public API
- Public exports
src/main.ts - Layout dispatcher
src/gridify.ts - Geometry utilities
src/utils.ts
Curve layouts
- Hilbert curve
src/hilbert.ts - Gilbert curve
src/gilbert.ts - Gosper curve
src/gosper.ts
Grid methods
- DGrid layout
src/dgrid.ts - CMDS layout
src/cmds.ts - NMap layout
src/nmap.ts - GridFit layout
src/gridfit.ts
Other components
- Library caller
- Grid positions
- d3-delaunay
Connections 15
- Library caller → Public exports: calls API
README.md - Public exports → Layout dispatcher: exports
src/main.ts - Library caller → Layout dispatcher: selects layout
README.md - Layout dispatcher → Grid positions: returns positions
README.md - Layout dispatcher → Hilbert curve: dispatches
src/gridify.ts - Layout dispatcher → Gilbert curve: dispatches
src/gridify.ts - Layout dispatcher → Gosper curve: dispatches
src/gridify.ts - Layout dispatcher → DGrid layout: dispatches
src/gridify.ts - Layout dispatcher → CMDS layout: dispatches
src/gridify.ts - Layout dispatcher → NMap layout: dispatches
src/gridify.ts - Layout dispatcher → GridFit layout: dispatches
src/gridify.ts - Hilbert curve → Geometry utilities: uses scales
src/hilbert.ts - Gilbert curve → Geometry utilities: gets bounds
src/gilbert.ts - NMap layout → Geometry utilities: gets bounds
src/nmap.ts - CMDS layout → d3-delaunay: builds proximity graph
src/cmds.ts