FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
FIFE::QuadTree< DataType, MinimumSize > Class Template Reference

#include <quadtree.h>

Inheritance diagram for FIFE::QuadTree< DataType, MinimumSize >:
Inheritance graph
Collaboration diagram for FIFE::QuadTree< DataType, MinimumSize >:
Collaboration graph

List of all members.

Public Member Functions

 QuadTree (int x=0, int y=0, int starting_size=MinimumSize)
Nodefind_container (int x, int y, int w, int h)
template<typename Visitor >
Visitor & apply_visitor (Visitor &visitor)

Detailed Description

template<typename DataType, int MinimumSize = 128>
class FIFE::QuadTree< DataType, MinimumSize >

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.


Constructor & Destructor Documentation

template<typename DataType, int MinimumSize = 128>
FIFE::QuadTree< DataType, MinimumSize >::QuadTree ( int  x = 0,
int  y = 0,
int  starting_size = MinimumSize 
)
inline

Create a new QuadTree

Parameters:
xThe X position of the starting node.
yThe Y position of the starting node.
starting_sizeThe width and height of the starting node.

Definition at line 159 of file quadtree.h.


Member Function Documentation

template<typename DataType, int MinimumSize = 128>
template<typename Visitor >
Visitor& FIFE::QuadTree< DataType, MinimumSize >::apply_visitor ( Visitor &  visitor)
inline

Apply a visitor recursively to the QuadTree

Definition at line 190 of file quadtree.h.

template<typename DataType , int MinimumSize>
QuadNode< DataType, MinimumSize > * FIFE::QuadTree< DataType, MinimumSize >::find_container ( int  x,
int  y,
int  w,
int  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.

Warning:
If you put different sized objects in (for example) lists in the quadnode, the returned node will not contain all objects which might intersect with the given rectangle.

Definition at line 359 of file quadtree.h.

References FIFE::QuadNode< DataType, MinimumSize >::create_parent(), and FIFE::QuadNode< DataType, MinimumSize >::find_container().


The documentation for this class was generated from the following file: