n-D spatial indexing data structures with a shared ES6 Map/Set-like API
npm install @thi.ng/geom-accel
!npm downloads

> [!NOTE]
> This is one of 214 standalone projects, maintained as part
> of the @thi.ng/umbrella monorepo
> and anti-framework.
>
> 🚀 Please help me to work full-time on these projects by sponsoring me on
> GitHub. Thank you! ❤️
- About
- Status
- Installation
- Dependencies
- Usage examples
- API
- Authors
- License
n-D spatial indexing data structures with a shared ES6 Map/Set-like API.
Some implementations were ported from the Clojure version of
thi.ng/geom.
Currently available:
- HashGrid2/3
- KdTreeMap
- KdTreeSet
- NdQuadtreeMap
- NdQuadtreeSet
- SpatialGrid2
- SpatialGrid3
STABLE - used in production
Search or submit any issues for this package
``bash`
yarn add @thi.ng/geom-accel
ESM import:
`ts`
import * as accel from "@thi.ng/geom-accel";
Browser ESM import:
`html`
For Node.js REPL:
`js`
const accel = await import("@thi.ng/geom-accel");
Package sizes (brotli'd, pre-treeshake): ESM: 4.71 KB
- @thi.ng/api
- @thi.ng/arrays
- @thi.ng/checks
- @thi.ng/distance
- @thi.ng/equiv
- @thi.ng/errors
- @thi.ng/geom-isec
- @thi.ng/heaps
- @thi.ng/math
- @thi.ng/transducers
- @thi.ng/vectors
Note: @thi.ng/api is in _most_ cases a type-only import (not used at runtime)
Seven projects in this repo's
/examples
directory are using this package:
| Screenshot | Description | Live demo | Source |
|:------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:-------------------------------------------------------|:------------------------------------------------------------------------------------|
|
| Basic 2D boid simulation and spatial indexing neighbor lookups | Demo | Source |
|
| Doodle w/ K-nearest neighbor search result visualization | Demo | Source |
|
| K-nearest neighbor search in an hash grid | Demo | Source |
|
| Poisson-disk shape-aware sampling, Voronoi & Minimum Spanning Tree visualization | Demo | Source |
|
| 2D Poisson-disc sampler with procedural gradient map | Demo | Source |
|
| Image-based Poisson-disk sampling | Demo | Source |
|
| 2D Stratified grid sampling example | Demo | Source |
TODO
If this project contributes to an academic publication, please cite it as:
`bibtex``
@misc{thing-geom-accel,
title = "@thi.ng/geom-accel",
author = "Karsten Schmidt",
note = "https://thi.ng/geom-accel",
year = 2013
}
© 2013 - 2026 Karsten Schmidt // Apache License 2.0