layermesh.quadtree module

Quadtrees for spatial searching in 2D meshes.

class layermesh.quadtree.quadtree(bounds, elements, parent=None)

Bases: object

Quadtree for spatial searching of mesh columns. On creation, the quadtree’s bounding box, elements and optional parent quadtree are specified.

Adapted from the quadtree data structure in PyTOUGH.

all_elements

The elements list of the zeroth-generation quadtree.

bounds

The quadtree’s bounding box.

child

A list of the quadtree’s child quadtrees.

elements

The elements in the quadtree.

generation

The generation index of the quadtree.

leaf(pos)

Returns the leaf containing the specified point pos.

property num_children

Number of children of the quadtree.

property num_elements

Number of elements in the quadtree.

parent

The quadtree’s parent quadtree.

search(pos)

Returns the element containing the specified point pos.

search_wave(pos)

Executes search wave for specified point pos on a quadtree leaf.

translate(shift)

Translates the quadtree horizontally by the specified shift vector (an array of length 2).