34 double sumCounter = 0;
35 double sumDenominator = 0;
39 double distance = std::sqrt( ( vertex.x - x ) * ( vertex.x - x ) + ( vertex.y - y ) * ( vertex.y - y ) );
45 double currentWeight = 1 / ( std::pow( distance, mDistanceCoefficient ) );
46 sumCounter += ( currentWeight * vertex.z );
47 sumDenominator += currentWeight;
50 if ( sumDenominator == 0.0 )
55 result = sumCounter / sumDenominator;
Base class for feedback objects to be used for cancellation of something running in a worker thread.
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.