Ignore:
Timestamp:
03/20/06 16:55:40 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r710 r711  
    467467} 
    468468 
     469 
    469470BspViewCell *BspTree::GetOrCreateOutOfBoundsCell() 
    470471{ 
     
    17061707 
    17071708                // construct child geometry with regard to the candidate split plane 
    1708                 BspNodeGeometry frontCell; 
    1709                 BspNodeGeometry backCell; 
    1710  
    1711                 cell.SplitGeometry(frontCell,  
    1712                                                    backCell,  
    1713                                                    candidatePlane, 
    1714                                                    mBox, 
    1715                                                    mEpsilon); 
     1709                BspNodeGeometry geomFront; 
     1710                BspNodeGeometry geomBack; 
     1711 
     1712                const bool splitSuccessFull =  
     1713                        cell.SplitGeometry(geomFront,  
     1714                                                           geomBack,  
     1715                                                           candidatePlane, 
     1716                                                           mBox, 
     1717                                                           mEpsilon); 
    17161718 
    17171719                if (mUseAreaForPvs) 
    17181720                { 
    1719                         pFront = frontCell.GetArea(); 
    1720                         pBack = backCell.GetArea(); 
     1721                        pFront = geomFront.GetArea(); 
     1722                        pBack = geomBack.GetArea(); 
    17211723                } 
    17221724                else 
    17231725                { 
    1724                         pFront = frontCell.GetVolume(); 
     1726                        pFront = geomFront.GetVolume(); 
    17251727                        pBack = pOverall - pFront; 
    17261728                } 
    17271729                 
     1730                 
     1731                // give penalty to unbalanced split 
     1732                if (1 &&  
     1733                        (!splitSuccessFull || (pFront <= 0) || (pBack <= 0) ||  
     1734                        !geomFront.Valid() || !geomBack.Valid())) 
     1735                { 
     1736                        Debug << "error f: " << pFront << " b: " << pBack << endl; 
     1737                        return 99999.9f; 
     1738                } 
    17281739 
    17291740                pOverall = probability; 
     
    17931804                val += mBalancedRaysFactor * fabs(sumBalancedRays) /  raysSize; 
    17941805 
    1795         const float denom = pOverall * (float)pvs * 2.0f + Limits::Small; 
     1806        const float denom = pOverall * (float)pvs + Limits::Small; 
    17961807 
    17971808        if (mSplitPlaneStrategy & PVS) 
    17981809        { 
    17991810                val += mPvsFactor * (frontPvs * pFront + (backPvs * pBack)) / denom; 
    1800  
    1801                 // give penalty to unbalanced split 
    1802                 if (0) 
    1803                 if (((pFront * 0.2 + Limits::Small) > pBack) ||  
    1804                         (pFront < (pBack * 0.2 + Limits::Small))) 
    1805                         val += 0.5; 
    18061811        } 
    18071812 
     
    19751980} 
    19761981 
    1977 int 
    1978 BspTree::_CastRay(Ray &ray) 
     1982 
     1983int BspTree::_CastRay(Ray &ray) 
    19791984{ 
    19801985        int hits = 0; 
     
    30853090                                                                        const float epsilon) const 
    30863091{        
    3087 #if 0 
    3088         // trivial cases 
    3089         const int cf = Side(splitPlane, epsilon); 
    3090  
    3091         if (cf == -1) 
    3092         { 
    3093                 back = *this; 
    3094                 return false; 
    3095         } 
    3096         else if (cf == 1) 
    3097         { 
    3098                 front = *this; 
    3099                 return false; 
    3100         } 
    3101 #endif 
     3092        //-- trivial cases 
     3093        if (0) 
     3094        { 
     3095                const int cf = Side(splitPlane, epsilon); 
     3096 
     3097                if (cf == -1) 
     3098                { 
     3099                        back = *this; 
     3100                        return false; 
     3101                } 
     3102                else if (cf == 1) 
     3103                { 
     3104                        front = *this; 
     3105                        return false; 
     3106                } 
     3107        } 
    31023108 
    31033109        // get cross section of new polygon 
Note: See TracChangeset for help on using the changeset viewer.