HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BV_Tree Class Referenceabstract

#include <BV_Tree.h>

+ Inheritance diagram for BV_Tree:

Public Types

enum  BV_Status { BV_PASS, BV_FAIL_ROTATIONS_UNSUPPORTED, BV_FAIL_BAD_TYPE, BV_FAIL }
 

Public Member Functions

 BV_Tree ()
 
virtual ~BV_Tree ()
 
BV_Treeclone () const
 
virtual const char * getType () const =0
 
virtual const BV_TreecastTo (const char *type) const
 
virtual BV_TreecastTo (const char *type)
 
int64 getMemoryUsage () const
 
int getNumLeaves () const
 
void build (BV_LeafIterator &leafIt)
 Construct a volume hierarchy from the given primitives. More...
 
void updateExtents (BV_LeafIterator &leafIt)
 
void save (std::ostream &os, bool onlyStructure) const
 
bool load (UT_IStream &is, bool onlyStructure)
 
BV_Status intersect (BV_Callback &callback, const BV_Tree &treeb, const UT_DMatrix4 &xforma, const UT_DMatrix4 &xformb, fpreal tol=0.001F) const
 
BV_Status intersect (BV_Callback &callback, const BV_Tree &treeb, fpreal tol=0.001F) const
 Static boxes only! More...
 
BV_Status intersect (BV_Callback &callback, const BV_Tree &treeb, const UT_DMatrix4 &startxforma, const UT_DMatrix4 &startxformb, const UT_DMatrix4 &endxforma, const UT_DMatrix4 &endxformb, fpreal tol=0.001F) const
 Moving boxes only! More...
 
BV_Status intersect (BV_Callback &callback, const BV_Tree &treeb, const UT_DMatrix4 &xforma, const UT_DMatrix4 &startxforma, const UT_DMatrix4 &startxformb, const UT_DMatrix4 &xformb, const UT_DMatrix4 &endxforma, const UT_DMatrix4 &endxformb, fpreal tol=0.001F) const
 Moving boxes only! More...
 

Protected Member Functions

 BV_Tree (const BV_Tree &tree)
 
virtual BV_TreecloneSubclass () const =0
 
virtual void buildSubclass (BV_LeafIterator &leafIt)=0
 
virtual int64 getMemoryUsageSubclass () const =0
 
virtual int getNumLeavesSubclass () const =0
 
virtual void saveSubclass (std::ostream &os, bool onlyStructure) const =0
 
virtual bool loadSubclass (UT_IStream &is, bool onlyStructure)=0
 
virtual void updateExtentsSubclass (BV_LeafIterator &leafIt)=0
 
virtual BV_Status intersectSubclass (BV_Callback &callback, const BV_Tree &treeb, const UT_DMatrix4 &startxforma, const UT_DMatrix4 &startxformb, const UT_DMatrix4 &endxforma, const UT_DMatrix4 &endxformb, fpreal tol) const =0
 

Detailed Description

Base class for bounding volume hierarchies. It's not really intended to be an all-encompassing base class; it's more intended as a rough template for other bounding volume classes to follow.

Definition at line 24 of file BV_Tree.h.

Member Enumeration Documentation

Enumerator
BV_PASS 
BV_FAIL_ROTATIONS_UNSUPPORTED 

Rotations are not allowed.

BV_FAIL_BAD_TYPE 

Tree B was an unsupported type.

BV_FAIL 

Failed for some other reason.

Definition at line 27 of file BV_Tree.h.

Constructor & Destructor Documentation

BV_Tree::BV_Tree ( )
virtual BV_Tree::~BV_Tree ( )
virtual
BV_Tree::BV_Tree ( const BV_Tree tree)
protected

Member Function Documentation

void BV_Tree::build ( BV_LeafIterator leafIt)
inline

Construct a volume hierarchy from the given primitives.

Definition at line 63 of file BV_Tree.h.

virtual void BV_Tree::buildSubclass ( BV_LeafIterator leafIt)
protectedpure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.

virtual const BV_Tree* BV_Tree::castTo ( const char *  type) const
virtual

Reimplemented in BV_OBBTree, and BV_KDOPTree< K >.

virtual BV_Tree* BV_Tree::castTo ( const char *  type)
virtual

Reimplemented in BV_OBBTree, and BV_KDOPTree< K >.

BV_Tree* BV_Tree::clone ( ) const
inline

Definition at line 39 of file BV_Tree.h.

virtual BV_Tree* BV_Tree::cloneSubclass ( ) const
protectedpure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.

int64 BV_Tree::getMemoryUsage ( ) const
inline

Definition at line 47 of file BV_Tree.h.

virtual int64 BV_Tree::getMemoryUsageSubclass ( ) const
protectedpure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.

int BV_Tree::getNumLeaves ( ) const
inline

Definition at line 49 of file BV_Tree.h.

virtual int BV_Tree::getNumLeavesSubclass ( ) const
protectedpure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.

virtual const char* BV_Tree::getType ( ) const
pure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.

BV_Status BV_Tree::intersect ( BV_Callback callback,
const BV_Tree treeb,
const UT_DMatrix4 xforma,
const UT_DMatrix4 xformb,
fpreal  tol = 0.001F 
) const
inline

Find intersections of bounding volumes of this tree ("A") with tree B, rotated by ra and rb and translated by ta and tb respectively. For each intersection, call the callback with the leaves whose bounding volumes overlap.

The callback can return a "stop" status to stop testing for further intersections.

Note:

  • Not all trees can deal with rotations. e.g., an AABB tree can't, unless it expands all nodes to handle the contents at any orientation.
  • method may not succeed if treeb is a different type.

Static boxes only!

Definition at line 84 of file BV_Tree.h.

BV_Status BV_Tree::intersect ( BV_Callback callback,
const BV_Tree treeb,
fpreal  tol = 0.001F 
) const
inline

Static boxes only!

Definition at line 96 of file BV_Tree.h.

BV_Status BV_Tree::intersect ( BV_Callback callback,
const BV_Tree treeb,
const UT_DMatrix4 startxforma,
const UT_DMatrix4 startxformb,
const UT_DMatrix4 endxforma,
const UT_DMatrix4 endxformb,
fpreal  tol = 0.001F 
) const
inline

Moving boxes only!

Definition at line 108 of file BV_Tree.h.

BV_Status BV_Tree::intersect ( BV_Callback callback,
const BV_Tree treeb,
const UT_DMatrix4 xforma,
const UT_DMatrix4 startxforma,
const UT_DMatrix4 startxformb,
const UT_DMatrix4 xformb,
const UT_DMatrix4 endxforma,
const UT_DMatrix4 endxformb,
fpreal  tol = 0.001F 
) const
inline

Moving boxes only!

Definition at line 124 of file BV_Tree.h.

virtual BV_Status BV_Tree::intersectSubclass ( BV_Callback callback,
const BV_Tree treeb,
const UT_DMatrix4 startxforma,
const UT_DMatrix4 startxformb,
const UT_DMatrix4 endxforma,
const UT_DMatrix4 endxformb,
fpreal  tol 
) const
protectedpure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.

bool BV_Tree::load ( UT_IStream is,
bool  onlyStructure 
)
inline

If the "onlyStructure" flag is set, then the dimensions of the boxes are not saved/loaded, only the structure of the tree.

Definition at line 57 of file BV_Tree.h.

virtual bool BV_Tree::loadSubclass ( UT_IStream is,
bool  onlyStructure 
)
protectedpure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.

void BV_Tree::save ( std::ostream &  os,
bool  onlyStructure 
) const
inline

If the "onlyStructure" flag is set, then the dimensions of the boxes are not saved/loaded, only the structure of the tree.

Definition at line 55 of file BV_Tree.h.

virtual void BV_Tree::saveSubclass ( std::ostream &  os,
bool  onlyStructure 
) const
protectedpure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.

void BV_Tree::updateExtents ( BV_LeafIterator leafIt)
inline

Update an existing volume hierarchy by updating the bounding box sizes without changing the hierarchy structure.

Definition at line 67 of file BV_Tree.h.

virtual void BV_Tree::updateExtentsSubclass ( BV_LeafIterator leafIt)
protectedpure virtual

Implemented in BV_OBBTree, and BV_KDOPTree< K >.


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