Ignore:
Timestamp:
03/20/06 16:55:40 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
3 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 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r710 r711  
    1616#include "RssPreprocessor.h" 
    1717 
    18 #define SAMPLE_AFTER_SUBDIVISION 0 
     18#define SAMPLE_AFTER_SUBDIVISION 1 
    1919#define TEST_EMPTY_VIEW_CELLS 0 
    2020 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r710 r711  
    10551055        // subdivide further 
    10561056 
     1057        // store maximal and minimal depth 
     1058        if (tData.mDepth > mBspStats.maxDepth) 
     1059        { 
     1060                Debug << "max depth increases to " << tData.mDepth << " at " << mBspStats.Leaves() << " leaves" << endl; 
     1061                mBspStats.maxDepth = tData.mDepth; 
     1062        } 
     1063 
    10571064        mBspStats.nodes += 2; 
    10581065 
    1059          
     1066     
    10601067        BspInterior *interior = new BspInterior(splitPlane); 
    10611068 
     
    10641071#endif 
    10651072 
     1073 
    10661074        //-- create front and back leaf 
    10671075 
     
    10871095        interior->mTimeStamp = mTimeStamp ++; 
    10881096         
     1097 
    10891098        //DEL_PTR(leaf); 
    10901099        return interior; 
     
    11421151        // creates a sorted split candidates array 
    11431152        if (mSplitCandidates->capacity() > 500000 && 
    1144                 requestedSize < (int)(mSplitCandidates->capacity()  / 10) ) 
     1153                requestedSize < (int)(mSplitCandidates->capacity() / 10) ) 
    11451154        { 
    11461155        delete mSplitCandidates; 
     
    18511860                pBack = pOverall - pFront; 
    18521861                 
    1853                 // clamp because of possible precision issues 
     1862                // precision issues possible for unbalanced split => don't take this split! 
    18541863                if (1 &&  
    18551864                        (!splitSuccessFull || (pFront <= 0) || (pBack <= 0) ||  
     
    18571866                { 
    18581867                        Debug << "error f: " << pFront << " b: " << pBack << endl; 
    1859                         return 999; 
     1868                        return 99999.9f; 
    18601869                } 
    18611870        } 
     
    21672176        BspLeaf *leaf = dynamic_cast<BspLeaf *>(data.mNode); 
    21682177 
    2169         // store maximal and minimal depth 
    2170         if (data.mDepth > mBspStats.maxDepth) 
    2171                 mBspStats.maxDepth = data.mDepth; 
    21722178 
    21732179        if (data.mPvs > mBspStats.maxPvs) 
     2180        { 
    21742181                mBspStats.maxPvs = data.mPvs; 
    2175          
     2182        } 
     2183 
    21762184        mBspStats.pvs += data.mPvs; 
    21772185 
    21782186        if (data.mDepth < mBspStats.minDepth) 
     2187        { 
    21792188                mBspStats.minDepth = data.mDepth; 
     2189        } 
    21802190         
    21812191        if (data.mDepth >= mTermMaxDepth) 
     2192        { 
    21822193                ++ mBspStats.maxDepthNodes; 
     2194        } 
    21832195 
    21842196        // accumulate rays to compute rays /  leaf 
Note: See TracChangeset for help on using the changeset viewer.