00001 #include <esg/InspectorBVH.h> 00002 00003 using namespace esg; 00004 00005 const Geometry* InspectorBVH::firstElement() 00006 { 00007 if (!_pAggregate || !((BVH*)_pAggregate)->_root) return NULL; 00008 00009 _pActNode = ((BVH*)_pAggregate)->_root; 00010 _actDepth = 0; 00011 00012 while (_actDepth < _depth && !_pActNode->leaf) { 00013 _pActNode = _pActNode->leftChild; 00014 _actDepth++; 00015 } 00016 00017 return _pActNode->bv; 00018 } 00019 00020 const Geometry* InspectorBVH::nextElement() 00021 { 00022 if (!_pActNode) return NULL; 00023 00024 while (_pActNode->parent && 00025 _pActNode->parent->rightChild == _pActNode) // backtrack 00026 { 00027 _pActNode = _pActNode->parent; 00028 _actDepth--; 00029 } 00030 00031 if (!_pActNode->parent) return NULL; 00032 00033 _pActNode = _pActNode->parent->rightChild; 00034 while (_actDepth < _depth && !_pActNode->leaf) { 00035 _pActNode = _pActNode->leftChild; 00036 _actDepth++; 00037 } 00038 00039 return _pActNode->bv; 00040 }