spatial-kit
v0.0.1
Published
Framework-agnostic spatial relationships and region queries for interfaces.
Maintainers
Readme
Spatial Kit
Renderer-agnostic spatial relationships built on 2D geometry.
spatial-kit owns the higher-level spatial model that sits above geometry-kit: coordinate spaces, regions, relationships between objects, and queries over those relationships. It is still product-agnostic, but its package boundary is explicit.
Boundary
geometry-kit owns the operations. spatial-kit owns the meaning of those operations in a spatial model.
spatial-kit may own:
- coordinate spaces and mappings between them;
- named regions, bounds, anchors, and spatial relationships;
- containment, intersection, nearest-neighbour, and hit-test queries;
- spatial indexes for querying many objects without a renderer.
It must not own low-level vector arithmetic, matrix primitives, drawing, layout policy, pointer-event interpretation, animation timing, or application state. A feature belongs in geometry-kit when it is a pure 2D primitive. It belongs in spatial-kit when it describes or queries spatial relationships between those primitives.
Initial shape
type SpaceId = string;
mapPoint(point, from, to);
mapRect(rect, from, to);
contains(region, point);
intersects(first, second);
nearest(objects, point);
hitTest(objects, point);The API should remain plain-data and framework-agnostic. spatial-kit can depend on geometry-kit; geometry-kit must not depend on it.
License
MIT
