Skip to content

Commit 64cbda0

Browse files
committed
Minor quadtree documentation improvements
* pygorithm/data_structures/quadtree.py - minor doc changes
1 parent d4281b2 commit 64cbda0

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

pygorithm/data_structures/quadtree.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class QuadTree(object):
8181
8282
Just because a quad tree has split does not mean entities will be empty. Any
8383
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.
8585
8686
.. tip::
8787
@@ -178,7 +178,7 @@ def get_quadrant(self, entity):
178178
- 2: Bottom-right
179179
- 3: Bottom-left
180180
181-
.. caution::
181+
.. caution::
182182
183183
This function does not verify the entity is contained in this quadtree.
184184
@@ -195,10 +195,10 @@ def insert_and_think(self, entity):
195195
"""
196196
Insert the entity into this or the appropriate child.
197197
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`
202202
is too large.
203203
204204
:param entity: the entity to insert
@@ -245,8 +245,9 @@ def sum_entities(self, entities_per_depth=None):
245245
"""
246246
Sum the number of entities in this quad tree and all lower quad trees.
247247
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.
250251
251252
:param entities_per_depth: the result of :py:meth:`.find_entities_per_depth`
252253
:type entities_per_depth: `dict int: (int, int)` or None
@@ -284,6 +285,8 @@ def calculate_weight_misplaced_ents(self, sum_entities=None):
284285
than 1 implies a different tree type (such as r-tree or kd-tree) should probably be
285286
used.
286287
288+
This is implemented iteratively. See :py:meth:`.__str__` for usage example.
289+
287290
:param sum_entities: the number of entities on this node
288291
:type sum_entities: int or None
289292
:returns: weight of misplaced entities
@@ -325,7 +328,8 @@ def __str__(self):
325328
.. caution::
326329
327330
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.
329333
330334
Example:
331335

0 commit comments

Comments
 (0)