FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   algorithm for detecting lines intersection?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: algorithm for detecting lines intersection?  (Read 602 times)
lunetta

7200475272004752 WWW Email
algorithm for detecting lines intersection?
« on: Oct 3rd, 2004, 3:01pm »

Hello all community
Hope everybody had a nice summer (or nice winter depending on your coordinates)
 
I'm still dumb after this summer. I was planning to get smarter, but it didn't work out.
Anyway, that's why I can't figure out a simple nice way to detect when two lines with arbitrary coordinates intersect, and the coordinates of this intersection...
 
Any light?
 
thanks in advance
 
Frederik

WWW Email
Re: algorithm for detecting lines intersection?
« Reply #1 on: Oct 3rd, 2004, 3:18pm »

Have fun: http://astronomy.swin.edu.au/~pbourke/geometry/lineline2d/
 
seeya,
 
Frederik
 
rgovostes

rgovostes
Re: algorithm for detecting lines intersection?
« Reply #2 on: Oct 18th, 2004, 11:22pm »

If you have the equations for two lines, e.g. y = 0.25x + 6 and y = 3x - 12, you can solve for an equal point (they're a system of equations, after all).
 
Code:

Equation 1: y = 0.25x + 6
  -0.25x = -y + 6
       x = 4y - 24
 
Equation 2: y = 3x - 12
       y = 3(4y - 24) - 12
       y = 12y - 84
    -11y = -84
       y = 84/11 (this is the y value for the interception)
 
       x = 4(84/11) - 24
       x = 72/11 (this is the x value for the interception)
 
.'. the two lines intercept at (84/11, 72/11)
    (I know, it turned out to be messy.)
 
gll

WWW Email
Re: algorithm for detecting lines intersection?
« Reply #3 on: Oct 19th, 2004, 7:52pm »

I had the same kind of problems with geometry. Intersection of two lines, Intersection of a plan with a line, Two plans intersections, Intersection with angles.
 
So, I took a look to my college's math class. A book on Vector and Geometry was really helpfull. You could look at the Linear Algebra:
 
ftp://joshua.smcvt.edu/pub/hefferon/book/book.pdf
http://www.netcomuk.co.uk/~jenolive/homevec.html
http://omega.math.albany.edu:8008/mat220/
 

guillaume LaBelle
lunetta

7200475272004752 WWW Email
Re: algorithm for detecting lines intersection?
« Reply #4 on: Oct 21st, 2004, 1:56am »

Hey thanks for all the feedback
 
and those links were great... I'm studying them
 
Pages: 1 

« Previous topic | Next topic »