Ignore:
Timestamp:
03/27/06 18:56:45 (18 years ago)
Author:
mattausch
Message:

updating view cell hierarchy before pvs statistics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp

    r711 r719  
    4444 
    4545 
    46 /****************************************************************/ 
    47 /*                  class BspNode implementation                */ 
    48 /****************************************************************/ 
     46/******************************************************************/ 
     47/*                  class BspNode implementation                  */ 
     48/******************************************************************/ 
    4949 
    5050 
     
    20862086        stack<BspRayTraversalData> tStack; 
    20872087 
    2088         float mint = 0.0f, maxt = 1.0f; 
     2088                float mint = 0.0f, maxt = 1.0f; 
    20892089 
    20902090        Intersectable::NewMail(); 
     
    20972097        BspNode *farChild = NULL; 
    20982098 
     2099 
    20992100        const float thresh = 1 ? 1e-6f : 0.0f; 
    21002101 
     
    21042105                { 
    21052106                        BspInterior *in = dynamic_cast<BspInterior *>(node); 
    2106                  
     2107 
    21072108                        Plane3 splitPlane = in->GetPlane(); 
    21082109                         
     
    21132114                        { 
    21142115                                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)  
    21172119                                        continue; 
    2118                  
     2120   
    21192121                                farChild = in->GetFront(); // plane splits ray 
    2120                  
    21212122                        }  
    2122                         else if (entSide > 0)  
     2123                        else if (entSide > 0) 
    21232124                        { 
    21242125                                node = in->GetFront(); 
    2125                          
     2126 
    21262127                                if (extSide >= 0) // plane does not split ray => no far child 
    21272128                                        continue; 
    2128                          
    2129                                 farChild = in->GetBack(); // plane splits ray                    
     2129 
     2130                                farChild = in->GetBack(); // plane splits ray 
    21302131                        } 
    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? 
    21342134                                if (extSide < 0) 
    21352135                                        node = in->GetBack(); 
    21362136                                else //if (extSide > 0) 
    21372137                                        node = in->GetFront(); 
    2138                                 //else break; 
     2138                                //else break; // coincident => count no intersections 
    21392139 
    21402140                                continue; // no far child 
    21412141                        } 
    2142                  
     2142 
    21432143                        // push data for far child 
    21442144                        tStack.push(BspRayTraversalData(farChild, extp, maxt)); 
     
    21772177                } 
    21782178        } 
     2179 
    21792180        return hits; 
    21802181} 
     
    23192320                // split plane of node itself 
    23202321                n = n->GetParent(); 
    2321                  
     2322 
    23222323                if (n) 
    23232324                { 
     
    23612362        vector<Plane3> candidatePlanes; 
    23622363 
     2364        vector<Plane3>::const_iterator pit, pit_end = halfSpaces.end(); 
     2365 
    23632366        // 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); 
    23672370 
    23682371                if (p->Valid(mEpsilon)) 
    23692372                { 
    23702373                        candidatePolys.push_back(p); 
    2371                         candidatePlanes.push_back(halfSpaces[i]); 
     2374                        candidatePlanes.push_back(*pit); 
    23722375                } 
    23732376        } 
     
    24152418                                        DEL_PTR(candidatePolys[i]); 
    24162419 
    2417                                         if (frontPoly->Valid(mEpsilon)) 
    2418                                                 candidatePolys[i] = frontPoly; 
     2420                                        if (backPoly->Valid(mEpsilon)) 
     2421                                                candidatePolys[i] = backPoly; 
    24192422                                        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); 
    24232427                                        break; 
    24242428                                // polygon outside of halfspace 
Note: See TracChangeset for help on using the changeset viewer.