Public Member Functions | Static Public Attributes | Private Attributes
objtree::Octree Class Reference

#include <octree.h>

List of all members.

Public Member Functions

void clear ()
unsigned int count () const
ObjectgetSimilarObject (const Object *object)
ObjectgetSimilarObject (const Object *object, Node *node, Box box, unsigned int depth=0)
unsigned int insert (Object *object)
unsigned int insertOnFit (Object *object)
unsigned int insertOnInterfere (Object *object, Node *node, Box box, unsigned int depth=0)
unsigned int insertUpdate (Object *object)
unsigned int insertUpdate2 (Object *object)
unsigned int insertUpdateOnInterfere (Object *object, Node *node, Box box, bool &inserted, unsigned int depth=0)
bool isPositionFree (float x, float y, float z)
unsigned int maxId () const
void nodes (std::list< Box > &nodesList, std::set< Object * > &objectList, const Filter *filter)
void nodes (std::list< Box > &nodesList, std::set< Object * > &objectList, const Filter *filter, Box dim, Node *node)
const Objectobject (unsigned int id) const
void objects (std::set< Object * > &objectList, const Filter *filter)
const std::map< unsigned int,
Object * > & 
objectsAll () const
 Octree (unsigned int maxDepth=DEFAULT_MAX_DEPTH)
 Octree (const Box &rootSize, unsigned int maxDepth=DEFAULT_MAX_DEPTH)
bool removeObject (unsigned int id)
Noderoot () const
 ~Octree ()

Static Public Attributes

static const unsigned int DEFAULT_MAX_DEPTH = 4

Private Attributes

unsigned int m_maxDepth
unsigned int m_maxId
std::map< unsigned int, Object * > m_objects
Nodem_root
Box m_rootSize

Detailed Description

Main objtree class. Provides interface for working with octree.

Definition at line 48 of file octree.h.


Constructor & Destructor Documentation

objtree::Octree::Octree ( unsigned int  maxDepth = DEFAULT_MAX_DEPTH)

Default constructor. Creates octree with default sized root node (16.0 x 16.0 x 16.0).

Parameters:
maxDepthmaximum octree depth

Definition at line 41 of file octree.cpp.

objtree::Octree::Octree ( const Box rootSize,
unsigned int  maxDepth = DEFAULT_MAX_DEPTH 
)

A constructor. Creates octree with custom sized root node.

Parameters:
rootSizeroot node bounding box
maxDepthmaximum octree depth

Definition at line 55 of file octree.cpp.

A destructor

Definition at line 66 of file octree.cpp.


Member Function Documentation

void objtree::Octree::clear ( void  )

Clears all objects in octree. Resets octree to default state.

Definition at line 74 of file octree.cpp.

unsigned int objtree::Octree::count ( ) const

Returns number of objects in octree.

Returns:
number of octrees

Definition at line 520 of file octree.cpp.

Returns similar object to selected one.

Parameters:
objectobject to compare
Returns:
similar object pointer, NULL if not found

Definition at line 310 of file octree.cpp.

Object * objtree::Octree::getSimilarObject ( const Object object,
Node node,
Box  box,
unsigned int  depth = 0 
)

Returns similar object to selected one.

Parameters:
objectobject to compare
nodecurrent node in recursion
boxbounding box of current node
depthcurrent depth
Returns:
similar object pointer, NULL if not found

Definition at line 256 of file octree.cpp.

unsigned int objtree::Octree::insert ( Object object)

Inserts object into octree.

Parameters:
objectobject to insert
Returns:
inserted object id

Definition at line 320 of file octree.cpp.

unsigned int objtree::Octree::insertOnFit ( Object object)

Inserts object into the biggest node that fits entire object.

Parameters:
objectobject to insert
Returns:
inserted object id

Definition at line 88 of file octree.cpp.

unsigned int objtree::Octree::insertOnInterfere ( Object object,
Node node,
Box  box,
unsigned int  depth = 0 
)

Inserts object into all intersected leaf nodes.

Parameters:
objectobject to insert
nodecurrent node in recursion
boxbounding box of current node
depthcurrent depth
Returns:
inserted object id

Definition at line 124 of file octree.cpp.

unsigned int objtree::Octree::insertUpdate ( Object object)

Inserts or updates object into octree. Update object if there exists a similar object. Inserts otherwise.

Parameters:
objectobject to insert
Returns:
inserted object id

Definition at line 341 of file octree.cpp.

unsigned int objtree::Octree::insertUpdate2 ( Object object)

Inserts or updates object into octree, second variant. Update object if there exists a similar object. Inserts otherwise. This variant first find a similar object instead of finding it in inserting loop.

Parameters:
objectobject to insert
Returns:
inserted object id

Definition at line 354 of file octree.cpp.

unsigned int objtree::Octree::insertUpdateOnInterfere ( Object object,
Node node,
Box  box,
bool inserted,
unsigned int  depth = 0 
)

Inserts or updates object into all intersected leaf nodes. Updates object if there exists a similar object. Inserts otherwise.

Parameters:
objectobject to insert
nodecurrent node in recursion
boxbounding box of current node
depthcurrent depth
insertedhas been new object inserted?
Returns:
inserted object id

Definition at line 158 of file octree.cpp.

bool objtree::Octree::isPositionFree ( float  x,
float  y,
float  z 
)

Check if there is a free space in selected point.

Parameters:
x
y
z
Returns:
true if there is a free space, false otherwise

Definition at line 381 of file octree.cpp.

unsigned int objtree::Octree::maxId ( ) const

Returns maximum internal object id.

Returns:
maximum internal object id

Definition at line 511 of file octree.cpp.

void objtree::Octree::nodes ( std::list< Box > &  nodesList,
std::set< Object * > &  objectList,
const Filter filter 
)

Returns nodes and objects in area filtered by filter.

Parameters:
nodesListoutput list of nodes
objectListoutput set of objects
filterpointer to a filter class

Definition at line 420 of file octree.cpp.

void objtree::Octree::nodes ( std::list< Box > &  nodesList,
std::set< Object * > &  objectList,
const Filter filter,
Box  dim,
Node node 
)

Returns nodes and objects in area filtered by filter.

Parameters:
nodesListoutput list of nodes
objectListoutput set of objects
filterpointer to a filter class
dimrecursion node bounding box
noderecursion node

Definition at line 433 of file octree.cpp.

const Object * objtree::Octree::object ( unsigned int  id) const

Definition at line 468 of file octree.cpp.

void objtree::Octree::objects ( std::set< Object * > &  objectList,
const Filter filter 
)

Returns objects in area filtered by filter.

Parameters:
nodesListoutput list of nodes
filterpointer to a filter class

Definition at line 462 of file octree.cpp.

const std::map< unsigned int, Object * > & objtree::Octree::objectsAll ( ) const

Returns all objects in objtree.

Returns:
objects map

Definition at line 529 of file octree.cpp.

bool objtree::Octree::removeObject ( unsigned int  id)

Removes object with selected id from octree.

Parameters:
idobject id
Returns:
returns true if there was removed an object

Definition at line 481 of file octree.cpp.

Returns root node.

Returns:
root node

Definition at line 502 of file octree.cpp.


Member Data Documentation

const unsigned int objtree::Octree::DEFAULT_MAX_DEPTH = 4 [static]

Definition at line 51 of file octree.h.

unsigned int objtree::Octree::m_maxDepth [private]

Definition at line 57 of file octree.h.

unsigned int objtree::Octree::m_maxId [private]

Definition at line 56 of file octree.h.

std::map<unsigned int, Object*> objtree::Octree::m_objects [private]

Definition at line 58 of file octree.h.

Definition at line 54 of file octree.h.

Definition at line 55 of file octree.h.


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


srs_env_model
Author(s): Vit Stancl (stancl@fit.vutbr.cz), Tomas Lokaj, Jan Gorig, Michal Spanel (spanel@fit.vutbr.cz)
autogenerated on Sun Jan 5 2014 11:50:50