hxa7241_graphics::OctreeAgent< TYPE > Class Template Reference

#include <Octree.h>

Inheritance diagram for hxa7241_graphics::OctreeAgent< TYPE >:

Inheritance graph
[legend]
Collaboration diagram for hxa7241_graphics::OctreeAgent< TYPE >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~OctreeAgent ()
virtual bool isOverlappingCellV (const void *pItem, const Vector3r &lowerCorner, const Vector3r &upperCorner) const
 void-to-type forwarders
virtual dword getSubcellOverlapsV (const void *pItem, const Vector3r &lower, const Vector3r &middle, const Vector3r &upper) const

Protected Member Functions

 OctreeAgent ()
 standard object services ---------------------------------------------------
virtual bool isOverlappingCell (const TYPE &item, const Vector3r &lowerCorner, const Vector3r &upperCorner) const =0
 queries --------------------------------------------------------------------
virtual dword getSubcellOverlaps (const TYPE &item, const Vector3r &lowerCorner, const Vector3r &middlePoint, const Vector3r &upperCorner) const
 default implementation

Detailed Description

template<class TYPE>
class hxa7241_graphics::OctreeAgent< TYPE >

Agent abstract base, for client use with Octree.

Client of Octree must define a concrete derivative of OctreeAgent<ItemType>.

This is similar to a proxy: it is an intermediary for an Octree to query its typeless subject items, when inserting or removing.

The overlap methods are to determine an item's relation to a cell or cells, for insertion or removal. The parameters supply the bounds of the cell.

Return value of getSubcellOverlaps is 8 bits, each bit is a bool corresponding to a subcell, the high bit for subcell 7, the low bit for subcell 0.

Subcell numbering:

    y z       6 7
    |/   2 3  4 5
     -x  0 1
 
in binary:
    y z           110 111
    |/   010 011  100 101
     -x  000 001
 

The ___V methods simply apply a type-cast to void*s and forward to their abstract counterparts.

An Octree requires its contained items to provide positional info. But requiring the item classes to implement an OctreeItem interface would impose a direct interface change on every prospective item type, and enlarge their instances with a vptr.

Instead, this agent transfers the Octree-related interface/implementation away from the item type into a separate class. The Octree can now hold void pointers to items and call the agent to query them indirectly.


Constructor & Destructor Documentation

template<class TYPE>
hxa7241_graphics::OctreeAgent< TYPE >::OctreeAgent (  )  [inline, protected]

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

template<class TYPE>
virtual hxa7241_graphics::OctreeAgent< TYPE >::~OctreeAgent (  )  [inline, virtual]


Member Function Documentation

template<class TYPE>
bool hxa7241_graphics::OctreeAgent< TYPE >::isOverlappingCellV ( const void *  pItem,
const Vector3r lowerCorner,
const Vector3r upperCorner 
) const [inline, virtual]

void-to-type forwarders

Implements hxa7241_graphics::OctreeAgentV.

template<class TYPE>
dword hxa7241_graphics::OctreeAgent< TYPE >::getSubcellOverlapsV ( const void *  pItem,
const Vector3r lower,
const Vector3r middle,
const Vector3r upper 
) const [inline, virtual]

Implements hxa7241_graphics::OctreeAgentV.

template<class TYPE>
virtual bool hxa7241_graphics::OctreeAgent< TYPE >::isOverlappingCell ( const TYPE &  item,
const Vector3r lowerCorner,
const Vector3r upperCorner 
) const [protected, pure virtual]

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

Called by Octree to get relation of item to cell.

Implemented in Octree_Agent_Face.

template<class TYPE>
dword hxa7241_graphics::OctreeAgent< TYPE >::getSubcellOverlaps ( const TYPE &  item,
const Vector3r lowerCorner,
const Vector3r middlePoint,
const Vector3r upperCorner 
) const [protected, virtual]

default implementation

Called by Octree to get relation of item to subcell octants.

Override to make a more efficent calculation (boundary testing can be shared).

Returns:
8 bits, each a bool corresponding to a subcell, the high bit for subcell 7, the low bit for subcell 0.

Subcell numbering:
    y z       6 7
    |/   2 3  4 5
     -x  0 1
 
in binary:
    y z           110 111
    |/   010 011  100 101
     -x  000 001
 


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