Changeset 879 for GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
- Timestamp:
- 05/02/06 18:08:04 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r870 r879 3747 3747 3748 3748 3749 ViewCell *VspBspTree::GetViewCell(const Vector3 &point) 3750 { 3751 if (mRoot == NULL) 3752 return NULL; 3749 ViewCell *VspBspTree::GetViewCell(const Vector3 &point, const bool active) 3750 { 3751 if (mRoot == NULL) 3752 return NULL; 3753 3754 stack<BspNode *> nodeStack; 3755 nodeStack.push(mRoot); 3753 3756 3754 stack<BspNode *> nodeStack; 3755 nodeStack.push(mRoot); 3757 ViewCell *viewcell = NULL; 3756 3758 3757 ViewCell *viewcell = NULL; 3759 while (!nodeStack.empty()) 3760 { 3761 BspNode *node = nodeStack.top(); 3762 nodeStack.pop(); 3763 3764 if (node->IsLeaf()) 3765 { 3766 viewcell = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 3767 break; 3768 } 3769 else 3770 { 3771 BspInterior *interior = dynamic_cast<BspInterior *>(node); 3772 3773 // random decision 3774 if (interior->GetPlane().Side(point) < 0) 3775 nodeStack.push(interior->GetBack()); 3776 else 3777 nodeStack.push(interior->GetFront()); 3778 } 3779 } 3758 3780 3759 while (!nodeStack.empty()) { 3760 BspNode *node = nodeStack.top(); 3761 nodeStack.pop(); 3762 3763 if (node->IsLeaf()) { 3764 viewcell = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 3765 break; 3766 } else { 3767 3768 BspInterior *interior = dynamic_cast<BspInterior *>(node); 3769 3770 // random decision 3771 if (interior->GetPlane().Side(point) < 0) 3772 nodeStack.push(interior->GetBack()); 3773 else 3774 nodeStack.push(interior->GetFront()); 3775 } 3776 } 3777 3778 return viewcell; 3781 if (active) 3782 return mViewCellsTree->GetActiveViewCell(viewcell); 3783 else 3784 return viewcell; 3779 3785 } 3780 3786
Note: See TracChangeset
for help on using the changeset viewer.