[GRASS5] Problems about v.surf.idw

Hi;

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 = dydy + dxdx

why this is not:

list[i].dist = sqrt(dydy+dxdx) in the functions calculate_distances and
calculate_distances_noindex.

The second problem and the last for now is that:

in main code;

nsearch = npoints < seacrh_points ? npoints : seacrh_points

and search_points is defined 12 globally. So, nseach can nat be bigger
than 12. But again in the functions calculate_distances and
calculate_distances_noindex there are two for loops:

one is ;

for(i=0;i<nsearch;i++){

}
the other;

/* go thru rest of the points now */
for(;i<npoints;i++){

}
What is the rest?? nsearch is either equal to npoints or bigger than npoints.

Yours respectfully

Muzaffer Ayvaz
Istanbul Technical University


Yahoo! FareChase - Search multiple travel sites in one click.

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@gclements.plus.com>