Changeset 648 for GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
- Timestamp:
- 02/16/06 16:21:26 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r643 r648 332 332 AddMeshToPolygons(obj->GetMesh(), polys, obj); 333 333 ++ numObj; 334 334 335 //-- compute bounding box 335 336 if (!forcedBoundingBox) … … 381 382 else 382 383 mTermMinProbability *= mBox.GetVolume(); 384 385 // throw out unnecessary polygons 386 PreprocessPolygons(polys); 383 387 384 388 mBspStats.polys = (int)polys.size(); … … 1994 1998 1995 1999 2000 void VspBspTree::PreprocessPolygons(PolygonContainer &polys) 2001 { 2002 // preprocess: throw out polygons coincident to the view space box (not needed) 2003 PolygonContainer boxPolys; 2004 mBox.ExtractPolys(boxPolys); 2005 vector<Plane3> boxPlanes; 2006 2007 PolygonContainer::iterator pit, pit_end = boxPolys.end(); 2008 2009 // extract planes of box 2010 // TODO: can be done more elegantly than first extracting polygons 2011 // and take their planes 2012 for (pit = boxPolys.begin(); pit != pit_end; ++ pit) 2013 { 2014 boxPlanes.push_back((*pit)->GetSupportingPlane()); 2015 } 2016 2017 pit_end = polys.end(); 2018 2019 for (pit = polys.begin(); pit != pit_end; ++ pit) 2020 { 2021 vector<Plane3>::const_iterator bit, bit_end = boxPlanes.end(); 2022 2023 for (bit = boxPlanes.begin(); (bit != bit_end) && (*pit); ++ bit) 2024 { 2025 const int cf = (*pit)->ClassifyPlane(*bit, mEpsilon); 2026 2027 if (cf == Polygon3::COINCIDENT) 2028 { 2029 DEL_PTR(*pit); 2030 //Debug << "coincident!!" << endl; 2031 } 2032 } 2033 } 2034 2035 // remove deleted entries 2036 for (int i = 0; i < (int)polys.size(); ++ i) 2037 { 2038 while (!polys[i] && (i < (int)polys.size())) 2039 { 2040 swap(polys[i], polys.back()); 2041 polys.pop_back(); 2042 } 2043 } 2044 } 2045 2046 1996 2047 float VspBspTree::AccumulatedRayLength(const RayInfoContainer &rays) const 1997 2048 {
Note: See TracChangeset
for help on using the changeset viewer.