hxa7241_graphics::Octree< TYPE > Class Template Reference

#include <Octree.h>

Collaboration diagram for hxa7241_graphics::Octree< TYPE >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Octree (const Vector3r &positionOfLowerCorner, real sizeOfCube, dword maxItemCountPerCell, dword maxLevelCount, real minCellSize)
 standard object services ---------------------------------------------------
 ~Octree ()
 Octree (const Octree &)
Octreeoperator= (const Octree &)
bool insert (const TYPE &item, const OctreeAgent< TYPE > &agent)
 commands -------------------------------------------------------------------
bool remove (const TYPE &item, const OctreeAgent< TYPE > &agent)
void visit (OctreeVisitor< TYPE > &visitor) const
 queries --------------------------------------------------------------------
bool isEmpty () const
void getInfo (dword &byteSize, dword &leafCount, dword &itemRefCount, dword &maxDepth) const
const Vector3rgetPosition () const
real getSize () const
dword getMaxItemCountPerCell () const
dword getMaxLevelCount () const
real getMinCellSize () const

Detailed Description

template<class TYPE>
class hxa7241_graphics::Octree< TYPE >

Octree based spatial index.

Client must define concrete derivatives of OctreeAgent<ItemType> and OctreeVisitor<ItemType>.

maxItemCountPerCell is ignored where maxLevelCount or minCellSize is reached.

The octree is cubical and axis aligned, partitions are axis aligned, partitions divide in half, each level partitions the previous level in all three axiss.

Storage is contracted or expanded as needed by item insertion and removal.

(Occupies, very approximately, 20 bytes per point item. maybe...)

Octree is only an index: it points to client items, it does not manage storage of items themselves.

See also:
OctreeAgent

OctreeVisitor

The octree structure follows the Composite pattern.

This template wrapper ensures the items indexed by the octree, and the agents and visitors used when accessing them are, of matching types. All algorithmic work is delegated to OctreeRoot and OctreeCell derivatives in OctreeImplementation, which work with abstract base interfaces and void pointers.

For the insertion and removal commands, the agent provides an interface for the octree to query the typeless item, and for the visit query, the visitor provides callbacks to read tree nodes for carrying out the visit operation.


Constructor & Destructor Documentation

template<class TYPE>
hxa7241_graphics::Octree< TYPE >::Octree ( const Vector3r positionOfLowerCorner,
real  sizeOfCube,
dword  maxItemCountPerCell,
dword  maxLevelCount,
real  minCellSize 
) [inline]

standard object services ---------------------------------------------------

Constructs a particular format of octree.

* sizeOfCube is desired length along a side
* maxItemCountPerCell is desired max item pointers per leaf
* maxLevelCount is desired max depth of tree
* minCellSize is desired min size of cells

template<class TYPE>
hxa7241_graphics::Octree< TYPE >::~Octree (  )  [inline]

template<class TYPE>
hxa7241_graphics::Octree< TYPE >::Octree ( const Octree< TYPE > &   )  [inline]


Member Function Documentation

template<class TYPE>
Octree< TYPE > & hxa7241_graphics::Octree< TYPE >::operator= ( const Octree< TYPE > &   )  [inline]

Can throw storage allocation exceptions. In such cases the octree is unmodified.

template<class TYPE>
bool hxa7241_graphics::Octree< TYPE >::insert ( const TYPE &  item,
const OctreeAgent< TYPE > &  agent 
) [inline]

commands -------------------------------------------------------------------

Add pointer(s) to the item to the octree.

(If an item has non-zero volume, it may have pointers in multiple cells.)

Returns:
is the item inserted -- false if item not inside root bound Can throw storage allocation exceptions. In such cases the octree remains structurally ok, but the item will not be fully added, -- call this method again or the remove method.
See also:
remove, OctreeAgent

template<class TYPE>
bool hxa7241_graphics::Octree< TYPE >::remove ( const TYPE &  item,
const OctreeAgent< TYPE > &  agent 
) [inline]

Removes pointer(s) to the item from the octree.

(If an item has non-zero volume, it may have pointers in multiple cells.)

Returns:
is the item removed -- false if item wasn't present Can throw storage allocation exceptions. In such cases the octree remains structurally ok, but the item will not be fully removed, -- call this method again or the insert method.
See also:
insert, OctreeAgent

template<class TYPE>
void hxa7241_graphics::Octree< TYPE >::visit ( OctreeVisitor< TYPE > &  visitor  )  const [inline]

queries --------------------------------------------------------------------

Execute a visit query operation.

See also:
OctreeVisitor

template<class TYPE>
bool hxa7241_graphics::Octree< TYPE >::isEmpty (  )  const [inline]

Reports if the octree is empty.

template<class TYPE>
void hxa7241_graphics::Octree< TYPE >::getInfo ( dword &  byteSize,
dword &  leafCount,
dword &  itemRefCount,
dword &  maxDepth 
) const [inline]

Provides stats on the octree.

* byteSize is size in bytes
* leafCount is number of leafs
* itemRefCount is total number of item pointers in all leafs
* maxDepth is deepest depth of tree

template<class TYPE>
const Vector3r & hxa7241_graphics::Octree< TYPE >::getPosition (  )  const [inline]

Gives the position supplied at construction.

template<class TYPE>
real hxa7241_graphics::Octree< TYPE >::getSize (  )  const [inline]

Gives the size supplied at construction.

template<class TYPE>
dword hxa7241_graphics::Octree< TYPE >::getMaxItemCountPerCell (  )  const [inline]

Gives the leaf pointer limit supplied at construction.

template<class TYPE>
dword hxa7241_graphics::Octree< TYPE >::getMaxLevelCount (  )  const [inline]

Gives the depth limit supplied at construction.

template<class TYPE>
real hxa7241_graphics::Octree< TYPE >::getMinCellSize (  )  const [inline]

Gives the size limit supplied at construction.


The documentation for this class was generated from the following file:
Generated on Fri Feb 13 13:58:45 2009 for meshmorph by  doxygen 1.5.1