Question
[Math] Finding the intersection of two lines
Does anyone here happen to know how to find the intersection
of two lines? kglad, perhaps?
My situation is one or both of two possible scenarios. The difference in these two scenarios is how the lines are defined, and I am able to accommodate either:
Scenario 1: To define the two lines I have one point each, thus two known points, and with those points a known angle ranging from -180 to 180 -- this is one point and one angle per line. Illustrated here:
http://abeall.com/files/temp/vector.intersect.gif
(p3 in blue is the unknown point to be solved)
The angles face in a direction such that the lines will intersect, ie the intersection won't happen in the opposite direction of the angle, if that makes sense.
Scenario 2: I have two pairs of points to make the lines, thus four points total -- two points per line. The intersection may be on the line segments, or it may be extended beyond the line segments in either direction.
The lines will never be parallel.
I've spent a few hours researching online and found some possible solutions, by not being very mathematically inclined I get quite lost in all the notation and have had no luck creating an ActionScript translation.
One example that might be what I need:
http://www.faqs.org/faqs/graphics/algorithms-faq/
^ search for "Subject 1.03: How do I find intersections of 2 2D line segments?"
Any help would be greatly appreciate. Thanks!
My situation is one or both of two possible scenarios. The difference in these two scenarios is how the lines are defined, and I am able to accommodate either:
Scenario 1: To define the two lines I have one point each, thus two known points, and with those points a known angle ranging from -180 to 180 -- this is one point and one angle per line. Illustrated here:
http://abeall.com/files/temp/vector.intersect.gif
(p3 in blue is the unknown point to be solved)
The angles face in a direction such that the lines will intersect, ie the intersection won't happen in the opposite direction of the angle, if that makes sense.
Scenario 2: I have two pairs of points to make the lines, thus four points total -- two points per line. The intersection may be on the line segments, or it may be extended beyond the line segments in either direction.
The lines will never be parallel.
I've spent a few hours researching online and found some possible solutions, by not being very mathematically inclined I get quite lost in all the notation and have had no luck creating an ActionScript translation.
One example that might be what I need:
http://www.faqs.org/faqs/graphics/algorithms-faq/
^ search for "Subject 1.03: How do I find intersections of 2 2D line segments?"
Any help would be greatly appreciate. Thanks!
