[futurebasic] Re:How do you find the point where two lines cross?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1999 : Group Archive : Group : All Groups

From: Robert Covington <t88@...>
Date: Thu, 3 Jun 1999 06:45:08 -0700 (MST)
>I want to write a function that will take the x and y coordinates of the end
>points of two lines and return the coordinates of the point where the lines
>cross, if they do.
>
>I thought was going to be easy to solve but so far I can't. I wish I had paid
>more attention in Geometry class. Can anyone give me some pointers on how to
>approach this problem?
>
>-Joe Lertola

Joe,


http://www.mhri.edu.au/~pdb/geometry/lineline2d/

A great page with the formulas already there.


Otherwise,

For a line y=mx+b where m is slope (rise over run->  y/x typically) and "b"
is the offset from the origin for x, you can solve both lines for various x
and y. If they ever equal out, then you have an intersection. But the
method on his page can be used more efficiently, and it is set up to do
exactly what you want.


Anyone ever needing any computational geometry help and code should bookmark:

<http://www.mhri.edu.au/~pdb/>  (Great site)
<http://www.magic-software.com/> (Great for code of all kinds, including
imaging, if you can read C++ and are more math minded)

For file formats of any type:

<http://www.mhri.edu.au/~pdb/>
<http://www.wotsit.org/>

For graphics tutorials for rendering, and other:

<http://freespace.virgin.net/hugo.elias/>
<http://www.gameprogrammer.com/>

Do not mis-type and go to www.gameprogramming.com, or you will end up
somewhere not even remotely related.:)


Robert Covington

PS  I figured that Tedd would be sending out some region method while I
typed this, and darn if I wasn't right!