| 27 | } |
| 28 | |
| 29 | inline void addSample(const Point3 sample) |
| 30 | { |
| 31 | numSamples++; |
| 32 | float incWeight = 1.f / float(numSamples); |
| 33 | OPENPGL_ASSERT(numSamples > 0.0f); |
| 34 | OPENPGL_ASSERT(embree::isvalid(incWeight)); |
| 35 | OPENPGL_ASSERT(incWeight >= 0.0f); |
| 36 | |
| 37 | const Point3 oldMean = mean; |
| 38 | mean += (sample - oldMean) * incWeight; |
| 39 | variance += (((sample - oldMean) * (sample - mean)) - variance) * incWeight; |
| 40 | sampleBounds.extend(sample); |
| 41 | OPENPGL_ASSERT(isValid()); |
| 42 | } |
| 43 | |
| 44 | inline Point3 getMean() const |
| 45 | { |