Finding the Intersection of Two Lines
For lines that aren’t vertical.
1 2 3 4 5 |
For any linear line:
1 2 3 4 5 6 7 |
Say you have 2 lines 5x+2 and -x-1.
Using slope-intercept form(ax+b), we can fill in the parameters.
5x+2:
a = 5
b = 2
-x-1:
a = -1
b = -1
So to find the point at which these 2 lines meet, you would call the function like so:
1 | findIntersect(5, 2, -1, -1) |
It would trace:
(x=-0.5, y=-0.5)
If you want to have a vertical line, put the slope as NaN and the y-intercept as whatever you want y to equal to.
So y = 5 would be:
a = NaN
b = 5
Comments
One Response to “Finding the Intersection of Two Lines”
Got something to say?

Hi,you don’t know me,but I’m working as same as you guys,all that AS3 and AS2 coding. I’d like to get in touch with you. I have things to share such as AS3 and AS2 variable scanner (not the one you made),but a different one,with ability to browse the variables and many more things that me and my friend are working on .
As I said,I’d like to get in touch to share things. Probably you got my e-mail but here goes again: martin.ristov7@gmail.com .
Thank you,
Martin