QuadTree<E> class

A spatial data structure for efficient 2D range queries and collision detection

This QuadTree implementation is optimized for dynamic node insertion/removal and provides O(log n) average case performance for spatial queries.

Constructors

QuadTree({required int level, required Rect bounds})
Creates a new QuadTree with the specified level and bounds

Properties

bounds Rect
The boundary rectangle of this quadrant
final
hashCode int
The hash code for this object.
no setterinherited
isLeaf bool
Whether this quadrant is a leaf (contains nodes directly)
no setter
isSubdivided bool
Whether this quadrant has been subdivided
no setter
level int
The maximum depth of this quadrant in the tree
final
nodeCount int
Returns the total number of nodes in this QuadTree
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clears all nodes from the QuadTree
getNodesInBounds(Rect queryBounds, Size nodeSize) List<Node<E>>
Returns all nodes within the specified rectangular bounds
getNodesInRange(Offset center, double radius, Size nodeSize) List<Node<E>>
Returns all nodes within the specified circular range
getOverlappingNodes(Node<E> targetNode, Size nodeSize) List<Node<E>>
Returns all nodes that potentially overlap with the given node
getStats() QuadTreeStats
Returns statistics about the QuadTree structure
insert(Node<E> node, Size nodeSize) bool
Inserts a node into the QuadTree
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(Node<E> node, Size nodeSize) bool
Removes a node from the QuadTree
toString() String
A string representation of this object.
inherited
updateNode(Node<E> node, Size nodeSize, Offset oldPosition) bool
Updates a node's position in the QuadTree

Operators

operator ==(Object other) bool
The equality operator.
inherited