27 QgsIDWInterpolator::QgsIDWInterpolator():
QgsInterpolator( QList<LayerData>() ), mDistanceCoefficient( 2.0 )
47 double sumCounter = 0;
48 double sumDenominator = 0;
54 distance = sqrt(( vertex_it->x - x ) * ( vertex_it->x - x ) + ( vertex_it->y - y ) * ( vertex_it->y - y ) );
57 result = vertex_it->z;
60 currentWeight = 1 / ( pow( distance, mDistanceCoefficient ) );
61 sumCounter += ( currentWeight * vertex_it->z );
62 sumDenominator += currentWeight;
65 if ( sumDenominator == 0.0 )
70 result = sumCounter / sumDenominator;