Utilities

quads.visualize(tree, size=10)

Using matplotlib, generates a visualization of the QuadTree.

You will have to separately install matplotlib, as this library does not depend on it in any other way:

$ pip install matplotlib

Once installed, this will automatically generate an entire plot of all the points within, as well as lines for the subdivisions of nodes.

Parameters:
  • tree (QuadTree) – The quadtree itself.
  • size (int) – The size of the resulting output diagram.
quads.euclidean_distance(ref_point, check_point)

Calculates a euclidean distance between points.

Parameters:
  • ref_point (Point) – The first point to check.
  • check_point (Point) – The second point to check.
Returns:

The (unitless) distance value.

Return type:

int|float

quads.euclidean_compare(ref_point, check_point)

Calculates a raw euclidean value for comparison with other raw values.

This calculates the sum of the delta of X values plus the delta of Y values. It skips the square root portion of the Pythagorean theorem, for speed.

If you need a proper euclidean distance value, see euclidean_distance.

Primarily for internal use, but stable API if you need it.

Parameters:
  • ref_point (Point) – The first point to check.
  • check_point (Point) – The second point to check.
Returns:

The sum value.

Return type:

int|float