Default Quadtree Implementation. More...
#include <decDefaultQuadtree.h>
Public Member Functions | |
Constructors and Destructors | |
| decDefaultQuadtree (const decVector2 ¢er, const decVector2 &halfSize) | |
| Creates a new generic quadtree object. | |
| virtual | ~decDefaultQuadtree () |
| Cleans up the generic quadtree object. | |
Management | |
| virtual decQuadtree * | CreateQuadtree (int quadrant) const |
| Creates new quadtree for the specified quadrant. | |
| virtual void | ClearNodeContent () |
| Clears the content of this node. | |
| decDefaultQuadtree * | InsertIntoTree (void *element, const decVector2 &boxCenter, const decVector2 &boxHalfSize, int maxDepth=DECDO_MAX_DEPTH) |
| Adds a new object to the quadtree. | |
Elements | |
| int | GetElementCount () const |
| Retrieves the number of elements. | |
| void * | GetElementAt (int index) const |
| Retrieves the element at the given index. | |
| int | IndexOfElement (void *element) const |
| Retrieves the index of the given element or -1 if not found. | |
| void | AddElement (void *element) |
| Adds a element. | |
| void | RemoveElement (void *element) |
| Removes a element. | |
| void | RemoveAllElements () |
| Removes all elements. | |
Default Quadtree Implementation.
Default implementation of the quadtree storing a list of objects.
| decDefaultQuadtree::decDefaultQuadtree | ( | const decVector2 & | center, |
| const decVector2 & | halfSize | ||
| ) |
Creates a new generic quadtree object.
| virtual decDefaultQuadtree::~decDefaultQuadtree | ( | ) | [virtual] |
Cleans up the generic quadtree object.
| void decDefaultQuadtree::AddElement | ( | void * | element ) |
Adds a element.
| virtual void decDefaultQuadtree::ClearNodeContent | ( | ) | [virtual] |
Clears the content of this node.
Implements decQuadtree.
| virtual decQuadtree* decDefaultQuadtree::CreateQuadtree | ( | int | quadrant ) | const [virtual] |
Creates new quadtree for the specified quadrant.
Implement this function to create a new quadtree of your own type. Do not set the parent of quadtree. The caller is responsible for this action if applicable.
Implements decQuadtree.
| void* decDefaultQuadtree::GetElementAt | ( | int | index ) | const |
Retrieves the element at the given index.
| int decDefaultQuadtree::GetElementCount | ( | ) | const [inline] |
Retrieves the number of elements.
| int decDefaultQuadtree::IndexOfElement | ( | void * | element ) | const |
Retrieves the index of the given element or -1 if not found.
| decDefaultQuadtree* decDefaultQuadtree::InsertIntoTree | ( | void * | element, |
| const decVector2 & | boxCenter, | ||
| const decVector2 & | boxHalfSize, | ||
| int | maxDepth = DECDO_MAX_DEPTH |
||
| ) |
Adds a new object to the quadtree.
The object is placed in the node which hosts the specified box. Returns the node where the element has been placed into.
| void decDefaultQuadtree::RemoveAllElements | ( | ) |
Removes all elements.
| void decDefaultQuadtree::RemoveElement | ( | void * | element ) |
Removes a element.
1.7.2