delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/26/01:37:28

From: Einstein <einstein DOT lam AT usa DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ALLEGRO : check for Line intersecting a point . . . how?
Date: Tue, 26 Aug 1997 07:52:35 +0800
Organization: n/a
Lines: 25
Message-ID: <34021AC3.73F80277@usa.net>
References: <Pine DOT SUN DOT 3 DOT 95 DOT 970817091444 DOT 3388A-100000 AT ernie DOT eecs DOT uic DOT edu>
NNTP-Posting-Host: ip-49-104.dialup.hkstar.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Given 3 points, you can know whether they are collinear or not without
plotting the line.

Just build the equation from any two of them, then substitute the third
one into the equation. Check for some zero or nearly zero value.

Einstein
einstein DOT lam AT usa DOT net

>  On Thu, 14 Aug 1997, Thomas Harte wrote:
> 
> > Hi
> >
> >       I want to know in Allegro if a line I draw intersects a point I know. Is
> > there a way to do this using Allegro, or should I just implement my own line
> > algorithm? The reason I ask is that I am doing the level editor for my next
> > project, and obviously when you try to click and drag a line it would be
> > necessary for me to know which line you are attempting to click and drag . . .
> >
> >       Or, can you think of another way for me to do this? There is in theory
> > no maximum number of lines on screen, although maps above a certain complexity
> > probably won't be created for runtime speed reasons if nothing else.
> >
> >               -Thomas

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019