From: Schoeneck Howell Newsgroups: borland.public.delphi.graphics Subject: Re: point in line? Date: Fri, 21 Sep 2001 11:55:45 -0400 Message-ID: <34omqtc05j9ds64cr5npc5seum66kli58v@4ax.com> References: <3ba9bb39$1_1@dnews> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 206.138.130.2 X-Trace: dnews 1001087748 206.138.130.2 (21 Sep 2001 08:55:48 -0700) Lines: 45 Path: dnews Xref: dnews borland.public.delphi.graphics:42091 I wish I could provide proper attribution for the following, but I cannot recall where it came from. I used it in an application a few years back. t is the point in question, p-q is the line in question function pointonline(px,py,qx,qy,tx,ty : integer) : integer; // return 0 if t not on line p-q // 1 if t on open ray ending at p // 2 if t on interior p-q // 3 if t on open ray ending at q begin result:=2; if ( ABS((qy-py)*(tx-px)-(ty-py)*(qx-px)) >= (MAX(ABS(qx-px), ABS(qy-py)))) then result:=0; if (((qx wrote: >hello, > >how could I know if a point (x,y) in on a line (x1,y1,x2,y2)? > >thanks > >Armindo =================== Schoeneck Howell Federal Bureau of Prisons Office of Research and Evaluation showell@bop.gov