Metadata-Version: 2.4
Name: spacecell
Version: 0.1.0
Summary: Dependency-free spatial hash grid for bucketing points in 2D and 3D space.
Author: Peter Bower
License: MIT
License-File: LICENSE
Keywords: geometry,grid,hash,nearest-neighbour,spatial,spatial-hashing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# spacecell

Dependency-free spatial hash grid for bucketing points in 2D and 3D space.

A spatial hash grid partitions continuous space into a regular lattice of
fixed-size cells. Points that sit close together tend to share a cell, so
"which points are near this location?" becomes a lookup over a handful of
nearby cells instead of a scan over every point.

## Install

```bash
pip install spacecell
```

## Usage

```python
from spacecell import SpaceCell

grid = SpaceCell(cell_size=1.0)
grid.extend([(0.0, 0.0), (0.5, 0.5), (5.0, 5.0)])

# Points within one cell of the origin.
grid.neighbours((0.0, 0.0), radius=1)
# [(0.0, 0.0), (0.5, 0.5)]
```

The grid works in any dimension - pass 3-tuples for 3D, and so on.

## Licence

MIT
