@@ -81,7 +81,7 @@ class QuadTree(object):
81
81
82
82
Just because a quad tree has split does not mean entities will be empty. Any
83
83
entities which overlay any of the lines of the split will be included in the
84
- parent class of the quadtree.
84
+ parent of the quadtree.
85
85
86
86
.. tip::
87
87
@@ -178,7 +178,7 @@ def get_quadrant(self, entity):
178
178
- 2: Bottom-right
179
179
- 3: Bottom-left
180
180
181
- .. caution::
181
+ .. caution::
182
182
183
183
This function does not verify the entity is contained in this quadtree.
184
184
@@ -195,10 +195,10 @@ def insert_and_think(self, entity):
195
195
"""
196
196
Insert the entity into this or the appropriate child.
197
197
198
- This also acts as thinking (recursively). Using insert_and_think
199
- iteratively is slightly less efficient but more predictable performance,
200
- whereas initializing with a large number of entities then thinking is slightly
201
- faster but may hang. Both may exceed recursion depth if max_depth
198
+ This also acts as thinking (recursively). Using :py:meth:`. insert_and_think`
199
+ iteratively is slightly less efficient but has more predictable performance
200
+ than initializing with a large number of entities then thinking is slightly
201
+ faster but may hang. Both may exceed recursion depth if :py:attr:`. max_depth`
202
202
is too large.
203
203
204
204
:param entity: the entity to insert
@@ -245,8 +245,9 @@ def sum_entities(self, entities_per_depth=None):
245
245
"""
246
246
Sum the number of entities in this quad tree and all lower quad trees.
247
247
248
- If entities_per_depth is not None, that array is used to calculate the sum
249
- of entities rather than traversing the tree.
248
+ If `entities_per_depth` is not None, that array is used to calculate the sum
249
+ of entities rather than traversing the tree. Either way, this is implemented
250
+ iteratively. See :py:meth:`.__str__` for usage example.
250
251
251
252
:param entities_per_depth: the result of :py:meth:`.find_entities_per_depth`
252
253
:type entities_per_depth: `dict int: (int, int)` or None
@@ -284,6 +285,8 @@ def calculate_weight_misplaced_ents(self, sum_entities=None):
284
285
than 1 implies a different tree type (such as r-tree or kd-tree) should probably be
285
286
used.
286
287
288
+ This is implemented iteratively. See :py:meth:`.__str__` for usage example.
289
+
287
290
:param sum_entities: the number of entities on this node
288
291
:type sum_entities: int or None
289
292
:returns: weight of misplaced entities
@@ -325,7 +328,8 @@ def __str__(self):
325
328
.. caution::
326
329
327
330
Because of the complexity of quadtrees it takes a fair amount of calculation to
328
- produce something somewhat legible. All returned statistics have paired functions
331
+ produce something somewhat legible. All returned statistics have paired functions.
332
+ This uses only iterative algorithms to calculate statistics.
329
333
330
334
Example:
331
335
0 commit comments