Dragonfly 4.20
A text-based game engine
|
Public Member Functions | |
QuadtreeNode (QuadtreeNode *p_parent, int depth, Box boundary) | |
~QuadtreeNode () | |
ObjectList | getObjects () const |
Box | getBoundary () const |
int | getDepth () const |
int | insertObject (Object *p_o) |
int | removeObject (Object *p_o) |
int | split () |
QuadtreeNode * | findOwner (Object *p_o) |
QuadtreeNode * | findOwner (Object *p_o, Vector where) |
QuadtreeNode * | findOwner (Object *p_o, Box b) |
ObjectList | getCollisions (Object *p_o, Vector where) const |
std::string | toString () const |
Private Member Functions | |
ObjectList | getCollisions (Object *p_o, Vector where, int delta, bool self) const |
Private Attributes | |
int | m_depth |
Box | m_boundary |
QuadtreeNode * | m_p_parent |
ObjectList | m_objects |
bool | m_split |
QuadtreeNode * | m_p_child [4] |
df::QuadtreeNode::QuadtreeNode | ( | QuadtreeNode * | p_parent, |
int | depth, | ||
Box | boundary | ||
) |
Construct new node with given parent, depth and boundary.
df::QuadtreeNode::~QuadtreeNode | ( | ) |
Destructor, free up child nodes.
QuadtreeNode * df::QuadtreeNode::findOwner | ( | Object * | p_o | ) |
Return node in hierarchy where Object should be placed.
Return NULL if error.
QuadtreeNode * df::QuadtreeNode::findOwner | ( | Object * | p_o, |
Box | b | ||
) |
Return node in hierarchy where Object should be placed if has new bounding box.
Return NULL if error.
QuadtreeNode * df::QuadtreeNode::findOwner | ( | Object * | p_o, |
Vector | where | ||
) |
Return node in hierarchy where Object should be placed if moved to 'where'.
Return NULL if error.
Box df::QuadtreeNode::getBoundary | ( | ) | const |
Get boundary.
ObjectList df::QuadtreeNode::getCollisions | ( | Object * | p_o, |
Vector | where | ||
) | const |
Return all Objects that collide at given location.
List is empty if none.
int df::QuadtreeNode::getDepth | ( | ) | const |
Get depth.
ObjectList df::QuadtreeNode::getObjects | ( | ) | const |
Return list of Objects at this node.
int df::QuadtreeNode::insertObject | ( | Object * | p_o | ) |
Insert Object at this node and split if count > threshold.
Return 0 if ok, else -1.
int df::QuadtreeNode::removeObject | ( | Object * | p_o | ) |
Remove Object from this node.
Return 0 if ok (found), else -1.
int df::QuadtreeNode::split | ( | ) |
Split this node if it hasn't already.
Return 0 if ok, else -1.
std::string df::QuadtreeNode::toString | ( | ) | const |
Return current node as string.
|
private |
Bounding box of this node.
|
private |
Depth of this node.
|
private |
Objects contained in this node.
|
private |
Child nodes (NULL when none).
|
private |
Parent node (NULL if root).
|
private |
True if already split children.