QuadTree

data class QuadTree(val cell: Rectangle, val children: List<QuadTree> = emptyList(), val isFull: Boolean = false, val isEmpty: Boolean = false)(source)

A node in an adaptive quadtree over a Rectangle, as described in https://www.mattkeeter.com/projects/contours/

A region is recursively split into four children -- lower-left, lower-right, upper-left and upper-right, in that order -- down to some maximum depth, where subtrees that are fully inside (isFull) or fully outside (isEmpty) the shape collapse into a single childless node instead. A childless node that is neither isFull nor isEmpty (isLeaf) is a cell that straddles the boundary.

Constructors

Link copied to clipboard
constructor(cell: Rectangle, children: List<QuadTree> = emptyList(), isFull: Boolean = false, isEmpty: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val cell: Rectangle
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

True if this node is a childless cell that straddles the shape's boundary.

Functions

Link copied to clipboard

Finds the dual graph of this, as described in https://www.mattkeeter.com/projects/contours/: one point per leaf cell (its center), and one polygon for every grid vertex shared by two or more leaves -- a quad where four same-depth leaves meet, or a triangle at a "hanging" T-junction where one coarser leaf borders two finer ones.