igor::iOctree< F > Class Template Reference

#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
 

Detailed Description

template<typename F>
class igor::iOctree< F >

octree implementation

Member Typedef Documentation

◆ Node

template<typename F >
using igor::iOctree< F >::Node = iOctreeNode

◆ NodePtr

template<typename F >
using igor::iOctree< F >::NodePtr = std::shared_ptr<iOctreeNode>

◆ Object

template<typename F >
using igor::iOctree< F >::Object = iOctreeObject

◆ ObjectPtr

template<typename F >
using igor::iOctree< F >::ObjectPtr = std::shared_ptr<iOctreeObject>

◆ Objects

template<typename F >
using igor::iOctree< F >::Objects = std::vector<ObjectPtr>

Constructor & Destructor Documentation

◆ iOctree()

template<typename F >
iOctree::iOctree ( const iAACube< F > &  maxVolume,
const uint32  splitThreshold = 8,
const uint32  maxDepth = 16 
)

creates the octree including the root node

Parameters
maxVolumevolume of the whole octree
splitThresholdthreshold count of objects on a node before splitting the node
maxDepththe maximum depth of the tree

◆ ~iOctree()

template<typename F >
virtual igor::iOctree< F >::~iOctree ( )
virtualdefault

dtor

Member Function Documentation

◆ clear()

template<typename F >
void iOctree::clear ( )

clears the tree

◆ getMaxDepth()

template<typename F >
uint32 iOctree::getMaxDepth ( ) const
Returns
configured max depth of tree

◆ getRoot()

template<typename F >
const std::shared_ptr< typename iOctree< F >::iOctreeNode > & iOctree::getRoot ( ) const
Returns
root of tree

◆ getSplitThreshold()

template<typename F >
uint32 iOctree::getSplitThreshold ( ) const
Returns
split threshold

◆ getVolume()

template<typename F >
const iAACube< F > & iOctree::getVolume ( ) const
Returns
dimensions of octree

◆ insert()

template<typename F >
void iOctree::insert ( const std::shared_ptr< iOctreeObject object)

insert object at given position

Parameters
userDatathe user data

◆ query() [1/3]

template<typename F >
void iOctree::query ( const iAACube< F > &  cube,
std::vector< std::shared_ptr< iOctreeObject > > &  objects 
)

queries for objects within given cube

Parameters
cubethe given cube
objectsthe resulting found objects

◆ query() [2/3]

template<typename F >
void iOctree::query ( const iaSphere< F > &  sphere,
std::vector< std::shared_ptr< iOctreeObject > > &  objects 
)

queries for objects within given sphere

Parameters
spherethe given sphere
objectsthe resulting found objects

◆ query() [3/3]

template<typename F >
void iOctree::query ( const iFrustumd frustum,
std::vector< std::shared_ptr< iOctreeObject > > &  objects 
)

queries for objects within given frustum

Parameters
frustumthe given frustum
objectsthe resulting found objects

◆ remove()

template<typename F >
void iOctree::remove ( const std::shared_ptr< iOctreeObject object)

remove given object

Parameters
userDatathe user data

◆ update() [1/2]

template<typename F >
void iOctree::update ( const std::shared_ptr< iOctreeObject object,
const iaSphere< F > &  sphere 
)

updates position and radius of given object

Parameters
objectthe object to update
spherethe new position and radius of the object

◆ update() [2/2]

template<typename F >
void iOctree::update ( const std::shared_ptr< iOctreeObject object,
const iaVector3< F > &  position 
)

updates position of given object

Parameters
objectthe object to update
positionthe new position of the object

The documentation for this class was generated from the following files: