Changeset 719 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
- Timestamp:
- 03/27/06 18:56:45 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r711 r719 44 44 45 45 46 /**************************************************************** /47 /* class BspNode implementation */48 /**************************************************************** /46 /******************************************************************/ 47 /* class BspNode implementation */ 48 /******************************************************************/ 49 49 50 50 … … 2086 2086 stack<BspRayTraversalData> tStack; 2087 2087 2088 float mint = 0.0f, maxt = 1.0f;2088 float mint = 0.0f, maxt = 1.0f; 2089 2089 2090 2090 Intersectable::NewMail(); … … 2097 2097 BspNode *farChild = NULL; 2098 2098 2099 2099 2100 const float thresh = 1 ? 1e-6f : 0.0f; 2100 2101 … … 2104 2105 { 2105 2106 BspInterior *in = dynamic_cast<BspInterior *>(node); 2106 2107 2107 2108 Plane3 splitPlane = in->GetPlane(); 2108 2109 … … 2113 2114 { 2114 2115 node = in->GetBack(); 2115 2116 if(extSide <= 0) // plane does not split ray => no far child 2116 2117 // plane does not split ray => no far child 2118 if (extSide <= 0) 2117 2119 continue; 2118 2120 2119 2121 farChild = in->GetFront(); // plane splits ray 2120 2121 2122 } 2122 else if (entSide > 0) 2123 else if (entSide > 0) 2123 2124 { 2124 2125 node = in->GetFront(); 2125 2126 2126 2127 if (extSide >= 0) // plane does not split ray => no far child 2127 2128 continue; 2128 2129 farChild = in->GetBack(); // plane splits ray 2129 2130 farChild = in->GetBack(); // plane splits ray 2130 2131 } 2131 else // ray and plane are coincident 2132 { 2133 // NOTE: what to do if ray is coincident with plane? 2132 else // one of the ray end points is on the plane 2133 { // NOTE: what to do if ray is coincident with plane? 2134 2134 if (extSide < 0) 2135 2135 node = in->GetBack(); 2136 2136 else //if (extSide > 0) 2137 2137 node = in->GetFront(); 2138 //else break; 2138 //else break; // coincident => count no intersections 2139 2139 2140 2140 continue; // no far child 2141 2141 } 2142 2142 2143 2143 // push data for far child 2144 2144 tStack.push(BspRayTraversalData(farChild, extp, maxt)); … … 2177 2177 } 2178 2178 } 2179 2179 2180 return hits; 2180 2181 } … … 2319 2320 // split plane of node itself 2320 2321 n = n->GetParent(); 2321 2322 2322 2323 if (n) 2323 2324 { … … 2361 2362 vector<Plane3> candidatePlanes; 2362 2363 2364 vector<Plane3>::const_iterator pit, pit_end = halfSpaces.end(); 2365 2363 2366 // bounded planes are added to the polygons 2364 for ( int i = 0; i < (int)halfSpaces.size(); ++ i)2365 { 2366 Polygon3 *p = GetBoundingBox().CrossSection( halfSpaces[i]);2367 for (pit = halfSpaces.begin(); pit != pit_end; ++ pit) 2368 { 2369 Polygon3 *p = GetBoundingBox().CrossSection(*pit); 2367 2370 2368 2371 if (p->Valid(mEpsilon)) 2369 2372 { 2370 2373 candidatePolys.push_back(p); 2371 candidatePlanes.push_back( halfSpaces[i]);2374 candidatePlanes.push_back(*pit); 2372 2375 } 2373 2376 } … … 2415 2418 DEL_PTR(candidatePolys[i]); 2416 2419 2417 if ( frontPoly->Valid(mEpsilon))2418 candidatePolys[i] = frontPoly;2420 if (backPoly->Valid(mEpsilon)) 2421 candidatePolys[i] = backPoly; 2419 2422 else 2420 DEL_PTR(frontPoly); 2421 2422 DEL_PTR(backPoly); 2423 DEL_PTR(backPoly); 2424 2425 // outside, don't need this 2426 DEL_PTR(frontPoly); 2423 2427 break; 2424 2428 // polygon outside of halfspace
Note: See TracChangeset
for help on using the changeset viewer.