10 if (inserted) ++
count;
16 if (node->
IsLeaf())
return node;
18 for (uint8_t i = 0; i < 4; ++i) {
Defines the QuadTree class for spatial partitioning in 2D space.
bool Contains(const Vector2D &v)
Checks if this bounding box contains a specified point.
Represents a node in a quadtree structure for spatial partitioning.
BoundingBox2D * GetBBox()
Retrieves the bounding box of the node.
bool IsLeaf()
Checks if the node is a leaf node (i.e., has no child nodes).
bool Insert(Triangle2D *triangle)
Inserts a triangle entity into the node.
void Subdivide(uint8_t depth=0)
Subdivides the node into child nodes if needed.
Node * GetChildNodes()
Retrieves the child nodes of this node.
QuadTree(const Vector2D &min, const Vector2D &max)
Constructs a QuadTree with specified bounds.
~QuadTree()
Destructor for the QuadTree class.
Node root
Root node of the quadtree.
Node * Intersect(Node *node, const Vector2D &p)
Recursively finds the node intersecting with a given point.
bool Insert(Triangle2D *triangle)
Inserts a triangle entity into the quadtree.
uint16_t count
Current count of entities in the quadtree.
void Rebuild()
Rebuilds the quadtree, recalculating all spatial partitions.
Represents a 2D triangle with support for UV mapping, depth, and intersection testing.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.