fastquadtree 1.0.0__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/Cargo.lock +1 -1
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/Cargo.toml +1 -1
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/PKG-INFO +1 -1
- fastquadtree-1.0.2/docs/api/pyqtree.md +4 -0
- fastquadtree-1.0.2/docs/future_features.md +30 -0
- fastquadtree-1.0.2/docs/styles/overrides.css +38 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/mkdocs.yml +19 -5
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pysrc/fastquadtree/_item.py +15 -5
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pysrc/fastquadtree/pyqtree.py +10 -7
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/.github/workflows/docs.yml +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/.github/workflows/release.yml +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/.gitignore +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/.pre-commit-config.yaml +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/LICENSE +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/README.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/assets/ballpit.png +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/assets/interactive_v2_rect_screenshot.png +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/assets/interactive_v2_screenshot.png +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/assets/quadtree_bench_throughput.png +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/assets/quadtree_bench_time.png +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/benchmark_native_vs_shim.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/cross_library_bench.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/quadtree_bench/__init__.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/quadtree_bench/engines.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/quadtree_bench/main.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/quadtree_bench/plotting.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/quadtree_bench/runner.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/requirements.txt +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/runner.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/benchmarks/system_info_collector.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/docs/api/point_item.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/docs/api/quadtree.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/docs/api/rect_item.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/docs/api/rect_quadtree.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/docs/benchmark.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/docs/index.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/docs/quickstart.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/docs/runnables.md +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/interactive/ballpit.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/interactive/interactive.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/interactive/interactive_v2.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/interactive/interactive_v2_rect.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/interactive/requirements.txt +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pyproject.toml +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pysrc/fastquadtree/__init__.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pysrc/fastquadtree/_base_quadtree.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pysrc/fastquadtree/_obj_store.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pysrc/fastquadtree/point_quadtree.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pysrc/fastquadtree/py.typed +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/pysrc/fastquadtree/rect_quadtree.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/src/geom.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/src/lib.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/src/quadtree.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/src/rect_quadtree.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/insertions.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/nearest_neighbor.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/query.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/rect_quadtree.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/rectangle_traversal.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_base_quadtree.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_clear.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_delete.rs +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_delete_by_object.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_delete_python.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_obj_store.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_point_quadtree_nn_runtime.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_pyqtree_shim_compat.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_python.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_rect_quadtree.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_unconventional_bounds.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/test_wrapper_edges.py +0 -0
- {fastquadtree-1.0.0 → fastquadtree-1.0.2}/tests/unconventional_bounds.rs +0 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
# Future Features
|
2
|
+
|
3
|
+
Below are a list of features that may be added to future versions of this project.
|
4
|
+
If you really want any of these features, please let us know by opening an issue.
|
5
|
+
|
6
|
+
If you have any suggestions or would like to contribute, please feel free to open an issue or a pull request.
|
7
|
+
|
8
|
+
## Planned Features
|
9
|
+
|
10
|
+
### 1. Quadtree serialization
|
11
|
+
|
12
|
+
By serializing the quadtree, we can save its state to a file and load it later. This will allow us to persist the quadtree structure and data across sessions. For example, you could pre build a quadtree with all the walls in your video game level, serialize it to a file, and then load it when the game starts. This will heavily reduce the game load time since you won't have to rebuild the quadtree from scratch every time.
|
13
|
+
|
14
|
+
### 2. Circle support
|
15
|
+
|
16
|
+
Currently, we support points and rectangles in two separate quadtrees.
|
17
|
+
For example, in the ball-pit demo, we use a point quadtree, but then query a larger area to account for the radius of the balls.
|
18
|
+
With a circle quadtree, we could directly insert circles and perform circle-circle collision detection.
|
19
|
+
|
20
|
+
### 3. KNN with criteria function
|
21
|
+
|
22
|
+
Currently, KNN only supports finding the nearest neighbors based on euclidean distance.
|
23
|
+
By adding a criteria function, we could allow users to define custom criteria for finding neighbors by passing a function that
|
24
|
+
takes in a point and returns a score. The KNN algorithm would then use this score to determine the nearest neighbors.
|
25
|
+
|
26
|
+
### 4. KNN in rectangle quadtree
|
27
|
+
|
28
|
+
Currently, KNN is only supported in the point quadtree. By adding KNN support to the rectangle quadtree, we could allow users to find the nearest rectangles to a given point. This would be to the nearest edge of the rectangle, adding complexity to the algorithm.
|
29
|
+
However, it will allow for really quick collision detection between a point and a set of rectangles as the point can just do
|
30
|
+
robust-collision handling with the nearest rectangles.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/* Global typography tuning */
|
2
|
+
:root {
|
3
|
+
/* Larger base size for body copy */
|
4
|
+
--md-typeset-font-size: 0.98rem; /* default ~0.9-0.95 */
|
5
|
+
}
|
6
|
+
|
7
|
+
.md-typeset {
|
8
|
+
line-height: 1.65; /* more relaxed, better for focus */
|
9
|
+
letter-spacing: 0.001em;
|
10
|
+
}
|
11
|
+
|
12
|
+
/* Crisper headings without looking heavy */
|
13
|
+
.md-typeset h1, .md-typeset h2, .md-typeset h3 {
|
14
|
+
font-weight: 700;
|
15
|
+
line-height: 1.25;
|
16
|
+
}
|
17
|
+
|
18
|
+
/* Improve contrast on body text and links */
|
19
|
+
:root {
|
20
|
+
--md-default-fg-color: rgba(0,0,0,0.86);
|
21
|
+
--md-default-fg-color--light: rgba(0,0,0,0.64);
|
22
|
+
--md-typeset-a-color: #1e40af; /* indigo-800 like */
|
23
|
+
}
|
24
|
+
[data-md-color-scheme="slate"] {
|
25
|
+
--md-default-fg-color: rgba(255,255,255,0.92);
|
26
|
+
--md-default-fg-color--light: rgba(255,255,255,0.72);
|
27
|
+
--md-typeset-a-color: #93c5fd; /* lighter link on dark */
|
28
|
+
}
|
29
|
+
|
30
|
+
/* Make code a tad larger for readability */
|
31
|
+
.md-typeset code, .md-typeset pre code {
|
32
|
+
font-size: 0.93em;
|
33
|
+
}
|
34
|
+
|
35
|
+
/* Slightly stronger nav text */
|
36
|
+
.md-nav__item .md-nav__link {
|
37
|
+
font-weight: 500;
|
38
|
+
}
|
@@ -15,10 +15,18 @@ theme:
|
|
15
15
|
- toc.integrate
|
16
16
|
- search.suggest
|
17
17
|
- search.highlight
|
18
|
+
- content.tooltips
|
18
19
|
palette:
|
19
20
|
- scheme: slate
|
20
21
|
primary: indigo
|
21
22
|
accent: deep orange
|
23
|
+
font:
|
24
|
+
text: Inter
|
25
|
+
code: JetBrains Mono
|
26
|
+
|
27
|
+
extra_css:
|
28
|
+
- styles/overrides.css
|
29
|
+
|
22
30
|
|
23
31
|
plugins:
|
24
32
|
- search
|
@@ -36,6 +44,11 @@ plugins:
|
|
36
44
|
separate_signature: true
|
37
45
|
line_length: 88
|
38
46
|
heading_level: 2
|
47
|
+
filters: # Exclude __slots__ and __len__ and anything with a single underscore prefix
|
48
|
+
- "!__slots__"
|
49
|
+
- "!__len__"
|
50
|
+
- "!_.*"
|
51
|
+
|
39
52
|
- autorefs
|
40
53
|
- git-revision-date-localized:
|
41
54
|
fallback_to_build_date: true
|
@@ -68,11 +81,13 @@ nav:
|
|
68
81
|
- Quickstart: quickstart.md
|
69
82
|
- Runnables: runnables.md
|
70
83
|
- Benchmark: benchmark.md
|
84
|
+
- Future Features: future_features.md
|
71
85
|
- API:
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
86
|
+
- QuadTree: api/quadtree.md
|
87
|
+
- RectQuadTree: api/rect_quadtree.md
|
88
|
+
- pyqtree: api/pyqtree.md
|
89
|
+
- RectItem: api/rect_item.md
|
90
|
+
- PointItem: api/point_item.md
|
76
91
|
|
77
92
|
extra:
|
78
93
|
social:
|
@@ -82,5 +97,4 @@ extra:
|
|
82
97
|
link: https://pypi.org/project/fastquadtree/
|
83
98
|
|
84
99
|
# Build options
|
85
|
-
extra_css: []
|
86
100
|
extra_javascript: []
|
@@ -23,17 +23,22 @@ class Item:
|
|
23
23
|
__slots__ = ("geom", "id_", "obj")
|
24
24
|
|
25
25
|
def __init__(self, id_: int, geom: Point | Bounds, obj: Any | None = None):
|
26
|
-
self.id_ = id_
|
27
|
-
self.geom = geom
|
28
|
-
self.obj = obj
|
26
|
+
self.id_: int = id_
|
27
|
+
self.geom: Point | Bounds = geom
|
28
|
+
self.obj: Any | None = obj
|
29
29
|
|
30
30
|
|
31
31
|
class PointItem(Item):
|
32
32
|
"""
|
33
33
|
Lightweight point item wrapper for tracking and as_items results.
|
34
|
+
|
35
|
+
Attributes:
|
36
|
+
id_: Integer identifier.
|
37
|
+
geom: The point geometry as (x, y).
|
38
|
+
obj: The attached Python object if available, else None.
|
34
39
|
"""
|
35
40
|
|
36
|
-
__slots__ = ("
|
41
|
+
__slots__ = ("x", "y")
|
37
42
|
|
38
43
|
def __init__(self, id_: int, geom: Point, obj: Any | None = None):
|
39
44
|
super().__init__(id_, geom, obj)
|
@@ -43,9 +48,14 @@ class PointItem(Item):
|
|
43
48
|
class RectItem(Item):
|
44
49
|
"""
|
45
50
|
Lightweight rectangle item wrapper for tracking and as_items results.
|
51
|
+
|
52
|
+
Attributes:
|
53
|
+
id_: Integer identifier.
|
54
|
+
geom: The rectangle geometry as (min_x, min_y, max_x, max_y
|
55
|
+
obj: The attached Python object if available, else None.
|
46
56
|
"""
|
47
57
|
|
48
|
-
__slots__ = ("
|
58
|
+
__slots__ = ("max_x", "max_y", "min_x", "min_y")
|
49
59
|
|
50
60
|
def __init__(self, id_: int, geom: Bounds, obj: Any | None = None):
|
51
61
|
super().__init__(id_, geom, obj)
|
@@ -48,14 +48,17 @@ class Index:
|
|
48
48
|
all the quad instances and lets you access their properties.
|
49
49
|
|
50
50
|
Example usage:
|
51
|
+
```python
|
52
|
+
from fastquadtree.pyqtree import Index
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
['duck', 'python']
|
54
|
+
|
55
|
+
spindex = Index(bbox=(0, 0, 100, 100))
|
56
|
+
spindex.insert('duck', (50, 30, 53, 60))
|
57
|
+
spindex.insert('cookie', (10, 20, 15, 25))
|
58
|
+
spindex.insert('python', (40, 50, 95, 90))
|
59
|
+
results = spindex.intersect((51, 51, 86, 86))
|
60
|
+
sorted(results) # ['duck', 'python']
|
61
|
+
```
|
59
62
|
"""
|
60
63
|
|
61
64
|
__slots__ = ("_free", "_item_to_id", "_objects", "_qt")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|