pub struct QuadTreeNode2D {
pub min: Vector2D,
pub max: Vector2D,
pub depth: usize,
pub children: QuadTreeChildren2D,
pub leaf: bool,
pub loose: bool,
/* private fields */
}Expand description
One node of the 2D quadtree, holding an axis-aligned region plus the entries that could not be pushed further down.
A node has either four child handles (subdivided) or none (leaf); children
live in the parent’s flat arena rather than behind Box pointers, so every
node is reachable through a single shared borrow and the structure stays
Clone/Debug derivable without interior mutability.
Fields§
§min: Vector2DThe minimum corner of the region this node covers.
max: Vector2DThe maximum corner of the region this node covers.
depth: usizeThe subdivision level, 0 at the root and incrementing per split.
children: QuadTreeChildren2DThe child node handles, all unset until the node subdivides.
leaf: boolA flag that is true once the node owns four valid child handles.
loose: boolA flag that is true once this node retains an entry which is not fully
contained by the node’s own region.
Such an entry stays in the parent forever, so a region-overlap prune is
unsound for this node: the body can sit entirely outside the node’s
region and still overlap a query. Marking the node loose makes the
query skip the region prune and fall back to the exact box test, which
is what keeps a body larger than the root region findable.