Ignore:
Timestamp:
09/03/06 03:13:29 (18 years ago)
Author:
mattausch
Message:

started osp mesh construction for obj files. Introduced new primitive faceintersectable

File:
1 edited

Legend:

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

    r1313 r1314  
    973973        mLocalSubdivisionCandidates->clear(); 
    974974 
    975         int requestedSize = 2 * (int)(rays.size()); 
     975        const int requestedSize = 2 * (int)(rays.size()); 
    976976 
    977977        // creates a sorted split candidates array 
     
    992992        { 
    993993                const bool positive = (*rit).mRay->HasPosDir(axis); 
    994                                  
     994                const bool delayMinEvent = false; 
     995 
     996                // origin point 
    995997                pos = (*rit).ExtrapOrigin(axis); 
    996                  
    997                 mLocalSubdivisionCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMin : SortableEntry::ERayMax,  
    998                                                                         pos, (*rit).mRay)); 
    999  
     998                const int oType = positive ? SortableEntry::ERayMin : SortableEntry::ERayMax; 
     999 
     1000                if (delayMinEvent && oType == SortableEntry::ERayMin) 
     1001                        pos += mEpsilon; // for walls 
     1002 
     1003                mLocalSubdivisionCandidates->push_back(SortableEntry(oType, pos, (*rit).mRay)); 
     1004 
     1005                // termination point 
    10001006                pos = (*rit).ExtrapTermination(axis); 
    1001  
    1002                 mLocalSubdivisionCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMax : SortableEntry::ERayMin,  
    1003                                                                         pos, (*rit).mRay)); 
     1007                const int tType = positive ? SortableEntry::ERayMax : SortableEntry::ERayMin; 
     1008 
     1009                if (delayMinEvent && tType == SortableEntry::ERayMin) 
     1010                        pos += mEpsilon; // for walls 
     1011 
     1012                mLocalSubdivisionCandidates->push_back(SortableEntry(tType, pos, (*rit).mRay)); 
    10041013        } 
    10051014 
     
    12061215        vector<SortableEntry>::const_iterator ci, ci_end = mLocalSubdivisionCandidates->end(); 
    12071216 
     1217#ifdef _DEBUG 
     1218        const float volRatio = tData.mBoundingBox.GetVolume() / (sizeBox * mBoundingBox.GetVolume()); 
     1219        const int leaves = mVspStats.Leaves(); 
     1220        const bool printStats = ((axis == 0) && (leaves > 0) && (leaves < 90)); 
     1221         
     1222        ofstream sumStats; 
     1223        ofstream pvslStats; 
     1224        ofstream pvsrStats; 
     1225 
     1226        if (printStats) 
     1227        { 
     1228                char str[64];  
     1229                 
     1230                sprintf(str, "tmp/vsp_heur_sum-%04d.log", leaves); 
     1231                sumStats.open(str); 
     1232                sprintf(str, "tmp/vsp_heur_pvsl-%04d.log", leaves); 
     1233                pvslStats.open(str); 
     1234                sprintf(str, "tmp/vsp_heur_pvsr-%04d.log", leaves); 
     1235                pvsrStats.open(str); 
     1236        } 
     1237 
     1238#endif 
    12081239        for (ci = mLocalSubdivisionCandidates->begin(); ci != ci_end; ++ ci) 
    12091240        { 
     
    12241255                        sum = pvsl * ((*ci).value - minBox) + pvsr * (maxBox - (*ci).value); 
    12251256                         
     1257#ifdef _DEBUG 
     1258                        if (printStats) 
     1259                        { 
     1260                                sumStats 
     1261                                        << "#Position\n" << currentPos << endl 
     1262                                        << "#Sum\n" << sum * volRatio << endl 
     1263                                        << "#Pvs\n" << pvsl + pvsr << endl; 
     1264 
     1265                                pvslStats 
     1266                                        << "#Position\n" << currentPos << endl 
     1267                                        << "#Pvsl\n" << pvsl << endl; 
     1268 
     1269                                pvsrStats 
     1270                                        << "#Position\n" << currentPos << endl 
     1271                                        << "#Pvsr\n" << pvsr << endl; 
     1272                        } 
     1273#endif 
    12261274 
    12271275                        if (sum < minSum) 
     
    12601308        } 
    12611309         
    1262         const float volRatio = tData.mBoundingBox.GetVolume() / (sizeBox * mBoundingBox.GetVolume()); 
    1263  
     1310#ifdef _DEBUG 
    12641311        Debug << "\n§§§§ eval local cost §§§§" << endl 
    12651312                  << "back pvs: " << penaltyBack << " front pvs: " << penaltyFront << " total pvs: " << penaltyOld << endl  
     
    12671314                  << "old rc: " << oldRenderCost * volRatio << " new rc: " << newRenderCost * volRatio << endl 
    12681315                  << "render cost decrease: " << oldRenderCost * volRatio - newRenderCost * volRatio << endl; 
    1269  
     1316#endif 
    12701317        return ratio; 
    12711318} 
Note: See TracChangeset for help on using the changeset viewer.