|
0.45.0
|
#include <iQuadtree.h>
Classes | |
| struct | iQuadtreeNode |
| struct | iQuadtreeObject |
Public Types | |
| using | Object = iQuadtreeObject |
| using | Node = iQuadtreeNode |
| using | ObjectPtr = std::shared_ptr< iQuadtreeObject > |
| using | NodePtr = std::shared_ptr< iQuadtreeNode > |
| using | Objects = std::vector< ObjectPtr > |
Public Member Functions | |
| iQuadtree (const iaRectangle< F > &box, const uint32 splitThreshold=4, const uint32 maxDepth=16) | |
| virtual | ~iQuadtree ()=default |
| void | insert (const std::shared_ptr< iQuadtreeObject > object) |
| void | remove (const std::shared_ptr< iQuadtreeObject > object) |
| void | update (const std::shared_ptr< iQuadtreeObject > object, const iaVector2< F > &position) |
| void | update (const std::shared_ptr< iQuadtreeObject > object, const iaCircle< F > &circle) |
| const std::shared_ptr< iQuadtreeNode > & | getRoot () const |
| void | query (const iaCircle< F > &circle, std::vector< std::shared_ptr< iQuadtreeObject > > &objects) |
| void | query (const iaRectangle< F > &rectangle, std::vector< std::shared_ptr< iQuadtreeObject > > &objects) |
| void | clear () |
| const iaRectangle< F > & | getArea () const |
| uint32 | getSplitThreshold () const |
| uint32 | getMaxDepth () const |
quadtree implementation
| using igor::iQuadtree< F >::Node = iQuadtreeNode |
| using igor::iQuadtree< F >::NodePtr = std::shared_ptr<iQuadtreeNode> |
| using igor::iQuadtree< F >::Object = iQuadtreeObject |
| using igor::iQuadtree< F >::ObjectPtr = std::shared_ptr<iQuadtreeObject> |
| using igor::iQuadtree< F >::Objects = std::vector<ObjectPtr> |
| iQuadtree::iQuadtree | ( | const iaRectangle< F > & | box, |
| const uint32 | splitThreshold = 4, |
||
| const uint32 | maxDepth = 16 |
||
| ) |
creates the quadtree including the root node
| box | volume of the whole quadtree |
| splitThreshold | threshold count of objects on a node before splitting the node |
| maxDepth | the maximum depth of the tree |
|
virtualdefault |
dtor
| void iQuadtree::clear | ( | ) |
clears the tree
| const iaRectangle< F > & iQuadtree::getArea | ( | ) | const |
| uint32 iQuadtree::getMaxDepth | ( | ) | const |
| const std::shared_ptr< typename iQuadtree< F >::iQuadtreeNode > & iQuadtree::getRoot | ( | ) | const |
| uint32 iQuadtree::getSplitThreshold | ( | ) | const |
| void iQuadtree::insert | ( | const std::shared_ptr< iQuadtreeObject > | object | ) |
insert object at given position
| userData | the user data |
| void iQuadtree::query | ( | const iaCircle< F > & | circle, |
| std::vector< std::shared_ptr< iQuadtreeObject > > & | objects | ||
| ) |
queries for objects within given circle
| circle | the given circle |
| objects | the resulting found objects |
| void iQuadtree::query | ( | const iaRectangle< F > & | rectangle, |
| std::vector< std::shared_ptr< iQuadtreeObject > > & | objects | ||
| ) |
queries for objects within given rectangle
| rectangle | the given rectangle |
| objects | the resulting found objects |
| void iQuadtree::remove | ( | const std::shared_ptr< iQuadtreeObject > | object | ) |
remove given object
| userData | the user data |
| void iQuadtree::update | ( | const std::shared_ptr< iQuadtreeObject > | object, |
| const iaCircle< F > & | circle | ||
| ) |
updates position and radius of given object
| object | the object to update |
| circle | the new position and radius of the object |
| void iQuadtree::update | ( | const std::shared_ptr< iQuadtreeObject > | object, |
| const iaVector2< F > & | position | ||
| ) |
updates position of given object
| object | the object to update |
| position | the new position of the object |