Ignore:
Timestamp:
07/06/07 00:38:58 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r2199 r2529  
    5959 
    6060        /** creates pvs and initializes it with the given entries.  
    61         Assumes that entries are sorted- 
     61                Assumes that entries are sorted. 
    6262        */ 
    6363        VerbosePvs(const vector<PvsEntry<T, S> > &samples); 
     
    6666        /** Compresses PVS lossless or lossy. 
    6767        */ 
    68         int Compress()  
    69         { 
    70                 return 0; 
    71         } 
    72          
    73         int GetSize() const  
    74         { 
    75                 return (int)mEntries.size(); 
    76         } 
    77          
    78         bool Empty() const  
    79         { 
    80                 return mEntries.empty(); 
    81         } 
    82  
    83         void Reserve(const int n)  
    84         {  
    85                 mEntries.reserve(n);  
    86         } 
    87  
     68        int Compress() { return 0; } 
     69         
     70        inline int GetSize() const { return (int)mEntries.size(); } 
     71         
     72        inline bool Empty() const { return mEntries.empty(); } 
     73 
     74        inline void Reserve(const int n) { mEntries.reserve(n); } 
    8875        /** Normalize the visibility of entries in order to get  
    89         comparable results. 
     76                comparable results. 
    9077        */ 
    9178        void NormalizeMaximum(); 
    92  
    9379        /** Merges pvs of a into this pvs. 
    94         Warning: very slow! 
     80                Warning: very slow! 
    9581        */ 
    9682        void MergeInPlace(const VerbosePvs<T, S> &a); 
    97  
    9883        /** Difference of pvs to pvs b. 
    9984        @returns number of different entries. 
    10085        */ 
    10186        int Diff(const VerbosePvs<T, S> &b); 
    102  
    10387        /** Finds sample in PVS. 
    10488                @param checkDirty if dirty part of the pvs should be checked for entry  
     
    11296 
    11397        bool GetSampleContribution(T sample, const float pdf, float &contribution); 
    114  
    11598        /** Adds sample to PVS. 
    11699                @returns contribution of sample (0 or 1) 
    117100        */ 
    118101        float AddSample(T sample, const float pdf); 
    119  
    120102        /** Adds sample to PVS without checking for presence of the sample 
    121103                warning: pvs remains unsorted! 
    122104        */ 
    123105        void AddSampleDirty(T sample, const float pdf); 
    124  
    125106        /** Adds sample dirty (on the end of the vector) but 
    126107                first checks if sample is already in clean part of the pvs. 
    127108        */ 
    128109        bool AddSampleDirtyCheck(T sample, const float pdf); 
    129  
    130         /** Sort pvs entries - this should always be called after a 
     110        /** Sort pvs entries. This should always be called after a 
    131111                sequence of AddSampleDirty calls  
    132112        */ 
    133113        void Sort(); 
    134  
    135114        /** Sort pvs entries assume that the pvs contains unique entries 
    136115        */ 
    137116        void SimpleSort(); 
    138  
    139117        /** Adds sample to PVS. 
    140118                @returns PvsData 
     
    142120        typename std::vector<PvsEntry<T, S> >::iterator  
    143121                AddSample2(T sample, const float pdf); 
    144  
    145122        /** Subtracts one pvs from another one. 
    146123                WARNING: could contains bugs 
     
    172149        */ 
    173150        void Clear(const bool trim = true); 
    174  
     151        /** Trim the vector containing the pvs. 
     152        */ 
    175153        void Trim(); 
    176154 
     
    186164                                          const VerbosePvs<T, S> &b); 
    187165 
    188         int GetSamples() const 
    189         { 
    190                 return mSamples; 
    191         } 
    192  
    193         bool IsDirty() const 
    194         { 
    195                 return mLastSorted < mEntries.size(); 
    196         } 
    197  
     166        inline int GetSamples() const { return mSamples; } 
     167 
     168        /** If there is an unsorted part in the pvs. 
     169        */ 
     170        bool IsDirty() const { return mLastSorted < mEntries.size(); } 
     171 
     172        /** If this pvs requires a resort to stay efficient. 
     173        */ 
    198174        bool RequiresResort() const 
    199175        { 
     
    212188                        mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN))  
    213189                { 
    214                                 //              cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 
     190                        // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 
    215191                        return true; 
    216192                } 
     
    219195        } 
    220196 
     197        /** If this pvs requires a resort to stay efficient. 
     198        */ 
    221199        bool RequiresResortLog() const 
    222200        { 
     
    227205        } 
    228206 
    229         int GetLastSorted() const 
    230         { 
    231                 return mLastSorted; 
    232         } 
     207        inline int GetLastSorted() const { return mLastSorted; } 
    233208 
    234209        typename PvsIterator<T, S> GetIterator() const; 
     
    236211protected: 
    237212 
     213        /** Merge pvs 1 from begin iterator to end iterator with 
     214                pvs 2 from begin iterator to end iterator. 
     215        */ 
    238216        static void Merge(VerbosePvs<T, S> &mergedPvs,  
    239217                                          const typename std::vector<PvsEntry<T, S> >::const_iterator &aBegin, 
     
    243221                                          const int aSamples,  
    244222                                          const int bSamples); 
     223 
    245224 
    246225        ////////////////////////////// 
Note: See TracChangeset for help on using the changeset viewer.