[GRASS5] Problems about v.surf.idw

Glynn Clements glynn at gclements.plus.com
Fri Nov 18 08:02:44 EST 2005


Muzaffer Ayvaz wrote:

>   I have some problems about the v.surf.idw.
>  
>  First of all, I couldnt understand why the distances calculated without using sqrt. I mean;
>  
>  list[i].dist = dy*dy + dx*dx
>  
>  why this is not:
>  
>  list[i].dist = sqrt(dy*dy+dx*dx) in the functions calculate_distances and
> calculate_distances_noindex.

Because nothing needs the actual distance. The code only needs to know
whether one distance is greater or less than another. Comparing the
squares of the distances works just as well as comparing the distances
themselves, and avoids an expensive square-root calculation.

I don't know enough about v.surf.idw to answer your other question.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list