Ignore:
Timestamp:
11/02/07 09:00:20 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
5 edited

Legend:

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

    r2548 r2559  
    55#include "ViewCellsManager.h" 
    66#include "Preprocessor.h" 
     7#include "Timer/PerfTimer.h" 
    78 
    89 
     
    1011#include "ArchModeler2MLRT.hxx" 
    1112#endif 
     13 
     14PerfTimer sFilterTimer; 
    1215 
    1316 
     
    6063        ObjectPvs filteredPvs; 
    6164 
    62     PvsFilterStatistics pvsStats = mPreprocessor. 
     65        sFilterTimer.Entry(); 
     66     
     67        PvsFilterStatistics pvsStats = mPreprocessor. 
    6368                mViewCellsManager->ApplyFilter2(vc,  
    6469                                                false,  
    6570                                                                                filterSize,  
    6671                                                                                filteredPvs); 
     72 
     73        sFilterTimer.Exit(); 
    6774 
    6875        //mDifferencePvs.Clear(false); 
     
    7279 
    7380        GetPvsDifference(filteredPvs, pvs, mPvsDifference); 
     81 
     82        cerr << "found " << mPvsDifference.size() << " different objects" << endl; 
    7483} 
    7584 
     
    7786bool DifferenceSampling::GenerateSample(SimpleRay &ray) 
    7887{ 
    79         if (mNumSamples -- <= 0) 
     88        if (mNumSamples <= 0) 
    8089        { 
     90                // choose random view cell 
    8191                ViewCellContainer &viewCells = mPreprocessor.mViewCellsManager->GetViewCells(); 
    8292                const int vcIdx = (int)RandomValue(0, (float)viewCells.size() - 0.5f); 
    8393 
    8494                mCurrentViewCell = viewCells[vcIdx]; 
     95 
     96                if (mCurrentViewCell->GetPvs().Empty()) 
     97                        return false; 
     98 
     99                cout << "computing new  difference set" << endl; 
    85100 
    86101                ComputeDifferenceSet(mCurrentViewCell, mPvsDifference); 
     
    91106        } 
    92107 
     108        if (mPvsDifference.empty()) 
     109                return false; 
     110 
     111        -- mNumSamples; 
     112 
     113        cout << "x"; 
    93114        Vector3 origin, direction;  
    94115        Vector3 point; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/FlexibleHeap.h

    r2542 r2559  
    6161        T Erase(T); 
    6262 
     63        void Reserve(const size_t n); 
     64 
    6365protected: 
    6466 
    65         void Place(T x, const unsigned int i); 
    66         void Swap(const unsigned int i, const unsigned int j); 
    67  
    68         unsigned int Parent(const unsigned int i) const { return (i - 1) / 2; } 
    69         unsigned int Left(const unsigned int i) const { return 2 * i + 1; } 
    70         unsigned int Right(const unsigned int i) const { return 2 * i + 2; } 
     67        inline void Place(T x, const unsigned int i); 
     68        inline void Swap(const unsigned int i, const unsigned int j); 
     69 
     70        inline unsigned int Parent(const unsigned int i) const { return (i - 1) / 2; } 
     71        inline unsigned int Left(const unsigned int i) const { return 2 * i + 1; } 
     72        inline unsigned int Right(const unsigned int i) const { return 2 * i + 2; } 
    7173 
    7274        void UpHeap(const unsigned int i); 
    7375        void DownHeap(const unsigned int i); 
    7476 
     77 
     78        /////// 
     79         
    7580        std::vector<T> mBuffer; 
    7681}; 
     
    104109} 
    105110 
     111template <typename T> 
     112void FlexibleHeap<T>::Reserve(const size_t n)  
     113{  
     114        mBuffer.reserve(n);  
     115} 
    106116 
    107117template <typename T> 
     
    273283        t->NotInHeap(); 
    274284 
     285        if (i < (int)mBuffer.size()) 
     286        { 
    275287        if (mBuffer[i]->GetPriority() < t->GetPriority()) 
    276288                DownHeap(i); 
    277289        else 
    278290                UpHeap(i); 
     291        } 
    279292 
    280293        return t; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2544 r2559  
    11291129        } 
    11301130         
    1131         ///// 
     1131        ///////////////// 
    11321132        //-- reserve constant block of rays 
    11331133         
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h

    r2543 r2559  
    7878 
    7979        // pool of vss rays to be used in one pass of the sampling 
    80         struct VssRayPool { 
     80        struct VssRayPool  
     81        { 
    8182                VssRayPool(): mRays(NULL), mIndex(0), mNumber(0)  
    8283                {} 
     
    8788                } 
    8889 
    89                 void Reserve(const int number) { 
     90                void Reserve(const int number)  
     91                { 
    9092                        DEL_PTR(mRays); 
    9193                        mRays = new VssRay[number]; 
     
    9395                } 
    9496 
    95                 void Clear() { 
     97                void Clear()  
     98                { 
    9699                        mIndex = 0; 
    97100                } 
    98                 VssRay *Alloc() { 
     101                 
     102                VssRay *Alloc()  
     103                { 
    99104                        // reset pool 
    100105                        if (mIndex == mNumber) 
     
    110115        VssRayPool mVssRayPool; 
    111116 
    112         void ReserveVssRayPool(const int n) { 
     117        void ReserveVssRayPool(const int n)  
     118        { 
    113119                mVssRayPool.Reserve(n); 
    114120        } 
    115121 
    116         void InitPass() { 
     122        void InitPass()  
     123        { 
    117124                mVssRayPool.Clear(); 
    118125        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r2543 r2559  
    164164                                LinkIncremental="1" 
    165165                                AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;&quot;$(QTDIR)\lib&quot;;.\QtInterface\Release;&quot;$(CG_LIB_PATH)&quot;" 
    166                                 GenerateDebugInformation="TRUE" 
     166                                GenerateDebugInformation="FALSE" 
    167167                                SubSystem="1" 
    168168                                LargeAddressAware="2" 
Note: See TracChangeset for help on using the changeset viewer.