0.45.0
![]() |
#include <iOctree.h>
Classes | |
struct | iOctreeNode |
struct | iOctreeObject |
Public Types | |
using | Object = iOctreeObject |
using | Node = iOctreeNode |
using | ObjectPtr = std::shared_ptr< iOctreeObject > |
using | NodePtr = std::shared_ptr< iOctreeNode > |
using | Objects = std::vector< ObjectPtr > |
Public Member Functions | |
iOctree (const iAACube< F > &maxVolume, const uint32 splitThreshold=8, const uint32 maxDepth=16) | |
virtual | ~iOctree ()=default |
void | insert (const std::shared_ptr< iOctreeObject > object) |
void | remove (const std::shared_ptr< iOctreeObject > object) |
void | update (const std::shared_ptr< iOctreeObject > object, const iaVector3< F > &position) |
void | update (const std::shared_ptr< iOctreeObject > object, const iaSphere< F > &sphere) |
const std::shared_ptr< iOctreeNode > & | getRoot () const |
void | query (const iaSphere< F > &sphere, std::vector< std::shared_ptr< iOctreeObject > > &objects) |
void | query (const iAACube< F > &cube, std::vector< std::shared_ptr< iOctreeObject > > &objects) |
void | query (const iFrustumd &frustum, std::vector< std::shared_ptr< iOctreeObject > > &objects) |
void | clear () |
const iAACube< F > & | getVolume () const |
uint32 | getSplitThreshold () const |
uint32 | getMaxDepth () const |
octree implementation
using igor::iOctree< F >::Node = iOctreeNode |
using igor::iOctree< F >::NodePtr = std::shared_ptr<iOctreeNode> |
using igor::iOctree< F >::Object = iOctreeObject |
using igor::iOctree< F >::ObjectPtr = std::shared_ptr<iOctreeObject> |
using igor::iOctree< F >::Objects = std::vector<ObjectPtr> |
iOctree::iOctree | ( | const iAACube< F > & | maxVolume, |
const uint32 | splitThreshold = 8 , |
||
const uint32 | maxDepth = 16 |
||
) |
creates the octree including the root node
maxVolume | volume of the whole octree |
splitThreshold | threshold count of objects on a node before splitting the node |
maxDepth | the maximum depth of the tree |
|
virtualdefault |
dtor
void iOctree::clear | ( | ) |
clears the tree
uint32 iOctree::getMaxDepth | ( | ) | const |
const std::shared_ptr< typename iOctree< F >::iOctreeNode > & iOctree::getRoot | ( | ) | const |
uint32 iOctree::getSplitThreshold | ( | ) | const |
const iAACube< F > & iOctree::getVolume | ( | ) | const |
void iOctree::insert | ( | const std::shared_ptr< iOctreeObject > | object | ) |
insert object at given position
userData | the user data |
void iOctree::query | ( | const iAACube< F > & | cube, |
std::vector< std::shared_ptr< iOctreeObject > > & | objects | ||
) |
queries for objects within given cube
cube | the given cube |
objects | the resulting found objects |
void iOctree::query | ( | const iaSphere< F > & | sphere, |
std::vector< std::shared_ptr< iOctreeObject > > & | objects | ||
) |
queries for objects within given sphere
sphere | the given sphere |
objects | the resulting found objects |
void iOctree::query | ( | const iFrustumd & | frustum, |
std::vector< std::shared_ptr< iOctreeObject > > & | objects | ||
) |
queries for objects within given frustum
frustum | the given frustum |
objects | the resulting found objects |
void iOctree::remove | ( | const std::shared_ptr< iOctreeObject > | object | ) |
remove given object
userData | the user data |
void iOctree::update | ( | const std::shared_ptr< iOctreeObject > | object, |
const iaSphere< F > & | sphere | ||
) |
updates position and radius of given object
object | the object to update |
sphere | the new position and radius of the object |
void iOctree::update | ( | const std::shared_ptr< iOctreeObject > | object, |
const iaVector3< F > & | position | ||
) |
updates position of given object
object | the object to update |
position | the new position of the object |