Selectively extract and filter point data using a custom filter operator.
- FilterType example:
template<typename T>
struct WeightedAverageAccumulator {
using ValueType = T;
WeightedAverageAccumulator(T const * const array, const T radius)
: mValues(array), mInvRadius(1.0/radius), mWeightSum(0.0), mValueSum(0.0) {}
void reset() { mWeightSum = mValueSum = T(0.0); }
void operator()(const T distSqr, const size_t pointIndex) {
mWeightSum += weight;
mValueSum += weight * mValues[pointIndex];
}
T result() const { return mWeightSum > T(0.0) ? mValueSum / mWeightSum : T(0.0); }
private:
T const * const mValues;
const T mInvRadius;
T mWeightSum, mValueSum;
};