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
pip install spacecell
Usage
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spacecell-0.1.0.tar.gz.
File metadata
- Download URL: spacecell-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f9a3bd03342bbd7efe51e182626f043fdd6bc0f8d72e2822d36ee99b482a65f
|
|
| MD5 |
ea084882b09216b64b6c4e46c1b23f8f
|
|
| BLAKE2b-256 |
2864257bf2623b1730207454a9543bf21d6ade8ce84acb7a52fdaeac37ff8c57
|
File details
Details for the file spacecell-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spacecell-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47860aaf69328bc2776e9409a001fcf60a7235cf77632b2f06e90fa8e5c4bc35
|
|
| MD5 |
86619896e693674bc9820d03e428277a
|
|
| BLAKE2b-256 |
275ae53e56952c2db2af56cd827087d8810355f0a84c47df227684ec49e6d623
|