[mshapiro@ncsa.uiuc.edu: Re: [cworth@east.isi.edu: Re: [GRASS5] [mshapiro@ncsa.uiuc.edu: bug in libes/gis/line_dist.c]]]
Markus Neteler
neteler at itc.it
Fri, 22 Feb 2002 07:45:23 +0100
--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
a fwd from Michael...
Greetings,
Markus
--huq684BweRXVnRxX
Content-Type: message/rfc822
Content-Disposition: inline
Return-Path: <mshapiro@ncsa.uiuc.edu>
Received: from camelot.itc.it (camelot [195.223.171.5])
by artemide.itc.it (8.11.3/8.11.3) with ESMTP id g1LImoF25781
for <neteler@itc.it>; Thu, 21 Feb 2002 19:48:50 +0100 (MET)
Received: from ex1.ncsa.uiuc.edu (ex1.ncsa.uiuc.edu [141.142.2.9])
by camelot.itc.it (8.11.3/8.11.3) with ESMTP id g1LImnA28333
for <neteler@itc.it>; Thu, 21 Feb 2002 19:48:49 +0100 (MET)
Received: from mx1.ncsa.uiuc.edu (mx1.ncsa.uiuc.edu [141.142.2.8])
by ex1.ncsa.uiuc.edu (8.11.6/8.11.6) with ESMTP id g1LImr406655
for <neteler@itc.it>; Thu, 21 Feb 2002 12:48:54 -0600 (CST)
Received: from pecos.ncsa.uiuc.edu (pecos.ncsa.uiuc.edu [141.142.4.6])
by mx1.ncsa.uiuc.edu (8.11.6/8.11.6) with ESMTP id g1LImlv00698
for <neteler@itc.it>; Thu, 21 Feb 2002 12:48:47 -0600 (CST)
From: Michael Shapiro <mshapiro@ncsa.uiuc.edu>
Received: (from mshapiro@localhost)
by pecos.ncsa.uiuc.edu (8.11.6/8.8.8) id g1LImkm24885
for neteler@itc.it; Thu, 21 Feb 2002 12:48:46 -0600 (CST)
Message-Id: <200202211848.g1LImkm24885@pecos.ncsa.uiuc.edu>
Subject: Re: [cworth@east.isi.edu: Re: [GRASS5] [mshapiro@ncsa.uiuc.edu: bug in libes/gis/line_dist.c]]
To: neteler@itc.it (Markus Neteler)
Date: Thu, 21 Feb 2002 12:48:45 -0600 (CST)
In-Reply-To: <20020221180030.V18437@itc.it> from "Markus Neteler" at Feb 21, 2002 06:00:30 PM
X-Mailer: ELM [version 2.5 PL2]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I agree with Radim. So now there are 3 votes for Radim, 0 for me!
Would you mind posting my agreement with Radim to the list for me?
>
> Hi Michel,
>
> one more comment attached. Just tell me if you
> don't want further comments forwarded.
>
> Markus
>
>
> On Feb 21, Radim Blazek wrote:
> > On Thursday 21 February 2002 13:45, Markus Neteler wrote:
> > > Hi developers,
> > > I was looking through the grass src code and found a bug in the
> > > G_distance2_point_to_line() function in libes/gis/line_dist.c
> > >
> > > lines 47,48 should be changed from
> > >
> > > dx = dx * t + x1;
> > > dy = dy * t + y1;
> > > to
> >
> > I think that (dx * t + x1, dy * t + y1) is point x,y projected to line
> > x1,y1->x2,y2 (comment in code: /* go t from x1,y1 towards x2,y2 */)
> > and we want distance between this point and and x,y. That is:
> > dx = dx * t + x1 - x;
> > dy = dy * t + y1 - y;
> >
> > You should have someone double check me on this, though, just to be sure :)
>
> I've double-checked this. Radim's fix above is correct.
>
> You might even write it in the following (equivalent) way to make a
> more clear parallel with the 3 cases above it in the code:
>
> dx = x - (dx * t + x1);
> dy = y - (dy * t + y1);
>
> (the change of sign is not significant to the final result since both
> dx and dy are squared at the end).
>
> Cheers,
>
> -Carl
>
> --
> Carl Worth
> USC Information Sciences Institute cworth@east.isi.edu
--huq684BweRXVnRxX--