distance calculations in s.surf.idw
Chris Skelly
chris at mqatmos.cic.mq.edu.au
Wed Feb 12 10:20:11 EST 1992
Hi out there,
I have two questions today...
1. Is there a FAQ (frequently asked questions) or FEP (frequently encountered
problems) list for grassp?
2. The following segment of code is from s.surf.idw main() and is used to
calculate the distance between points so that weights for interpolation
can be calculated based on the distance between them...
/* fill list with first nsearch points */
for (i = 0; i < nsearch ; i++)
{
dy = points[i].north - north;
dx = points[i].east - east;
list[i].dist = dy*dy + dx*dx;
list[i].z = points[i].z;
}
/* find the maximum distance */
maxdist = list[max=0].dist;
for (n = 1; n < nsearch; n++)
{
if (maxdist < list[n].dist)
maxdist = list[max=n].dist;
}
/* go thru rest of the points now */
for ( ; i < npoints; i++)
{
dy = points[i].north - north;
dx = points[i].east - east;
dist = dy*dy + dx*dx;
if (dist < maxdist)
{
/* replace the largest dist */
list[max].z = points[i].z;
list[max].dist = dist;
maxdist = list[max=0].dist;
for (n = 1; n < nsearch; n++)
{
if (maxdist < list[n].dist)
maxdist = list[max=n].dist;
}
}
}
My question here: how does this work in the latitude longitude
system, where you really need some spherical geometry to calculate
distance?
thinking i've missed something (as usual) in Oz
chris
--
|\/\/\/| Chris Skelly
| | School of Earth Sciences
| | High expolsives and Macquarie University
| (o)(o) school do NOT mix. North Ryde, 2109, NSW, OZ
C _) Tel: 612-805-8433
| ,___| Fax: 612-805-8428
| / chris at mqclimat.cic.mq.edu.au
More information about the grass-dev
mailing list