[GRASSLIST:3872] Re: distance between polygons

Radim Blazek blazek at itc.it
Wed Jun 12 11:12:36 EDT 2002


On Wednesday 12 June 2002 04:39 pm, Glynn Clements wrote:
> Johannes B|hler wrote:
> > > That won't necessarily produce the correct answer. The shortest
> > > distance could be between a vertex of one polygon and a point on an
> > > edge of the other polygon.
> >
> > you are right. I need the shortest distance between a vertex and an
> > edgepoint. is there a solution for this?
>
> The following function[1] computes the square of the shortest distance
> between a point and a line segment (which is either the distance to
> the line, or the distance to one of the endpoints).
>
> [1] from src/libes/vect32/diglib/line_dist.c

There is also v.distance, which should do the work on higher level.

Radim



More information about the grass-user mailing list