FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
Dynamic QuadTree A space partitioning tree automatically expanding to adjust to any object size put into the data structure. More...
#include <quadtree.h>
Public Types | |
typedef QuadNode< DataType, MinimumSize > | Node |
Public Member Functions | |
QuadTree (int32_t x=0, int32_t y=0, int32_t starting_size=MinimumSize) | |
Create a new QuadTree. More... | |
~QuadTree () | |
Node * | find_container (int32_t x, int32_t y, int32_t w, int32_t h) |
Find a container node for a given rectangle. More... | |
Node * | find_container (const Rect &rect) |
template<typename Visitor > | |
Visitor & | apply_visitor (Visitor &visitor) |
Apply a visitor recursively to the QuadTree. More... | |
void | clear () |
Protected Attributes | |
Node * | m_root |
Node * | m_cursor |
Dynamic QuadTree A space partitioning tree automatically expanding to adjust to any object size put into the data structure.
Definition at line 150 of file quadtree.h.
typedef QuadNode<DataType,MinimumSize> FIFE::QuadTree< DataType, MinimumSize >::Node |
Definition at line 152 of file quadtree.h.
|
inline |
Create a new QuadTree.
x | The X position of the starting node. |
y | The Y position of the starting node. |
starting_size | The width and height of the starting node. |
Definition at line 159 of file quadtree.h.
|
inline |
Definition at line 164 of file quadtree.h.
|
inline |
Apply a visitor recursively to the QuadTree.
Definition at line 190 of file quadtree.h.
Referenced by FIFE::InstanceTree::applyVisitor().
|
inline |
Definition at line 195 of file quadtree.h.
QuadNode< DataType, MinimumSize > * FIFE::QuadTree< DataType, MinimumSize >::find_container | ( | int32_t | x, |
int32_t | y, | ||
int32_t | w, | ||
int32_t | h | ||
) |
Find a container node for a given rectangle.
This guarantees to return a Node with the following properties: 1.) The node contains the rectangle (as defined by the contains function). 2.) All subnodes can not contain the rectangle or it has the MinimumSize. This function will extend the tree automatically so that this guarantee can be fulfilled. This function is optimized for sequential access. This means accessing different rectangles that are 'near' to each other will be fast.
Definition at line 359 of file quadtree.h.
Referenced by FIFE::InstanceTree::addInstance(), and FIFE::InstanceTree::findInstances().
|
inline |
Definition at line 183 of file quadtree.h.
|
protected |
Definition at line 205 of file quadtree.h.
|
protected |
Definition at line 204 of file quadtree.h.