Asked by:
Finding the intersection point of two lines using VB
Question

Hi everyone:
I need some help with a problem I'm having trying to write a function in VB. I need to find the intersection point of two lines. Each line is defined by a point (call it [x,y]) that the line passes through, and the angle (in radians) of the line. The lines will never be parallel  they will always cross at some point. All the material I can find on intersecting lines discusses them in terms of each line being defined by a start/end point...which doesn't help me. Can anyone give me some advice?
Thanks.
All replies

All the material I can find on intersecting lines discusses them in terms of each line being defined by a start/end point...which doesn't help me. Can anyone give me some advice?
You might be searching incorrectly. The intersection is calculated from the standard form for the line equation.
The first search is "how to convert the equation of a line from slope intercept form to standard form". Then you can search for the intercept solution.


Thanks for your help Acamar, but I should have pointed out that I'm neither a mathematician or a programmer. I can do some basic coding, but I can quickly get out of my depth.
You state that "Each line is defined by a point (call it [x,y]) that the line passes through, and the angle (in radians) of the line." Therefore you can express the equation for the line in slope intercept form y = mx + b where m is the slope and b is the y intercept (the value of y when x is zero). See:
http://www.mathwarehouse.com/algebra/linear_equation/slopeinterceptform.php
https://web.viu.ca/corrin/FRST121/Help/SlopeHelp.htm(That discussion is in degrees  see: http://www.teacherschoice.com.au/maths_library/angles/angles.htm)
Once you have the slope intercept form of the equation for the line you can convert it to standard form.
For example: http://www.mathwarehouse.com/algebra/linear_equation/slopeintercepttostandardform.phpThen you can use the example for intersection that you have already found.
 Proposed as answer by Reed KimbleMVP, Moderator Friday, March 23, 2018 12:02 PM


Thanks again Acamar  I do appreciate your time spent responding to my query. It probably makes complete sense to you, but it doesn't help me in the slightest. I was really after some insight into the VB code for this issue, not the maths.
Typically in this Forum we assist people with an expectation that the person being assisted will have an understanding of what they are trying to do when done. Sometimes code is provided straight up and others continuous responses until the thread originator understands.
In your case you don't want to know anything but instead want anybody else to just provide you copy/paste code. I suggest you search the internet for the code however you will probably not have an inkling how to find it since you don't want to know the basics of what it needs to do. Good luck.
I could read Acamars post and links and over time figure out how to use or write code if necessary. And I am certainly no mathematician nor do I get money for nothing and my checks for free..... ;)
La vida loca
 Edited by Mr. Monkeyboy Saturday, March 24, 2018 2:34 AM