ProgressiveFilterValue.h
Go to the documentation of this file.00001 /**<!--------------------------------------------------------------------> 00002 @class ProgressiveFilterValue 00003 @author Travis Fischer (fisch0920@gmail.com) 00004 @author Matthew Jacobs (jacobs.mh@gmail.com) 00005 @date Fall 2008 00006 00007 @brief 00008 Normalized value composed of a progressive sum of N contributions, 00009 each of which has an associated weight 00010 <!-------------------------------------------------------------------->**/ 00011 00012 #ifndef PROGRESSIVE_FILTER_VALUE_H_ 00013 #define PROGRESSIVE_FILTER_VALUE_H_ 00014 00015 #include <utils/SpectralSampleSet.h> 00016 00017 template <typename T = SpectralSampleSet> 00018 struct ProgressiveFilterValue : public SSEAligned { 00019 T numerator; 00020 real_t denominator; 00021 00022 inline ProgressiveFilterValue() 00023 : numerator(), denominator(0) 00024 { } 00025 00026 inline T getValue() const { 00027 if (denominator == 0) 00028 return T(); 00029 00030 return (numerator / denominator); 00031 } 00032 00033 inline void addSample(const T &value, real_t weight) { 00034 numerator += value * weight; 00035 denominator += weight; 00036 } 00037 }; 00038 00039 #endif // PROGRESSIVE_FILTER_VALUE_H_ 00040
Generated on 28 Feb 2009 for Milton by
1.5.6