35 double sumCounter = 0;
36 double sumDenominator = 0;
46 double currentWeight = 1 / ( std::pow( distance, mDistanceCoefficient ) );
47 sumCounter += ( currentWeight * vertex.z );
48 sumDenominator += currentWeight;
51 if ( sumDenominator == 0.0 )
56 result = sumCounter / sumDenominator;
Base class for feedback objects to be used for cancellation of something running in a worker thread.
static double distance2D(double x1, double y1, double x2, double y2)
Returns the 2D distance between (x1, y1) and (x2, y2).
int interpolatePoint(double x, double y, double &result, QgsFeedback *feedback=nullptr) override
Calculates interpolation value for map coordinates x, y.
QgsIDWInterpolator(const QList< QgsInterpolator::LayerData > &layerData)
Constructor for QgsIDWInterpolator, with the specified layerData sources.
Interface class for interpolations.
QVector< QgsInterpolatorVertexData > mCachedBaseData
Cached vertex data for input sources.
bool mDataIsCached
Flag that tells if the cache already has been filled.
Result cacheBaseData(QgsFeedback *feedback=nullptr)
Caches the vertex and value data from the provider.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Interpolation data for an individual source vertex.