QuadTree Class Reference

#include <Quadtree.h>

List of all members.

Public Member Functions

void SetSize (float minx, float miny, float maxx, float maxy)
void Insert (Object *obj)
void Remove (Object *obj)
void RemoveAll ()
void InRange (Object *Obj, float range, bool SP=false, uint TypeMask=TYPE_PLAYER, uint TypeValue=1)
bool Update (Object *data)


Detailed Description

A quad tree is a 2D data structure that keeps lots of objects nicely sorted in a tree with four children in every node, so that queries like "give me a list of objects that are near the point X,Y" works lighting fast.


Member Function Documentation

void QuadTree::InRange ( Object *  Obj,
float  range,
bool  SP = false,
uint  TypeMask = TYPE_PLAYER,
uint  TypeValue = 1 
) [inline]

Return a list of all objects found in the given range from the given point matching a specific type.

void QuadTree::Insert ( Object *  obj  ) 

Insert a object into the quad tree.

void QuadTree::Remove ( Object *  obj  ) 

Remove the object from the quad tree.

void QuadTree::RemoveAll (  ) 

Remove all objects from the quad tree

void QuadTree::SetSize ( float  minx,
float  miny,
float  maxx,
float  maxy 
)

Clear all the objects from the quadtree and set it to have given size.

bool QuadTree::Update ( Object *  data  )  [inline]

Update object's position in the quad tree. Must be called after every time object changes position. It is cheap to call if the object haven't moved to a different node, so you should'nt make any unneccessary optimizations to call Update less often if the object position has't changed.


The documentation for this class was generated from the following files:
Generated on Wed Aug 30 03:27:46 2006 for SWG EMU by  doxygen 1.4.7