A pure Python Quadtree implementation.
Reason this release was yanked:
This was a beta version of the package, but lacks that in the version.
Project description
quads
A pure Python Quadtree implementation.
Quadtrees are a useful data structure for sparse datasets where the position of the data is important. They're especially for spatial indexing & image processing.
Usage
>>> import quads
>>> tree = quads.QuadTree(
... (0, 0), # The center point
... 10, # The width
... 10, # The height
... )
# You can choose to simply represent points that exist.
>>> tree.insert((1, 2))
True
# ...or include extra data at those points.
>>> tree.insert(quads.Point(4, -3, data="Samus"))
True
# You can search for a given point. It returns the point if found...
>>> tree.find((1, 2))
Point(1, 2)
# Or `None` if there's no match.
>>> tree.find((4, -4))
None
# You can also find all the points within a given region.
>>> bb = quads.BoundingBox(min_x=-1, min_y=-2, max_x=2, max_y=2)
>>> tree.within_bb(bb)
[Point(1, 2)]
Setup
$ pip install quads
Requirements
- Python 3.7+ (untested on older versions but may work)
Running Tests
$ git clone https://github.com/toastdriven/quads.git
$ cd quads
$ poetry install
$ pytest .
License
New BSD
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quads-1.0.0.tar.gz
(4.3 kB
view details)
Built Distribution
quads-1.0.0-py3-none-any.whl
(4.4 kB
view details)
File details
Details for the file quads-1.0.0.tar.gz
.
File metadata
- Download URL: quads-1.0.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.7.4 Darwin/19.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cb68080ba7f80642ebaad601d0850a28f2bb135fb84556061d7902743962ef7 |
|
MD5 | 5126e192b8269cc1ca9ba8a3cb6f4921 |
|
BLAKE2b-256 | 8985bdfdf6d96c99785a92dae14cda97b821ac6bda0ae64d77c2e07d211aa28e |
File details
Details for the file quads-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: quads-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.7.4 Darwin/19.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a84a76480ae81cb2e14c7b0bbfc891a0a03e1db7c19c940867098df14e19f63f |
|
MD5 | b4885dfe1dd4f35c2ab367007bb7f1e0 |
|
BLAKE2b-256 | 4aa2b60130aa9b23cf7f17ee7def8ec9f7bafd77e4cb9bbc8ffba99660c5c7d2 |