PDA

View Full Version : Line intersection - with a difference



theta
01-03-2015, 04:35 PM
I have been working on a problem and through all of my research I have been unable to find an existing resolution. I do not have the required math knowledge to produce an elegant solution.

There are several examples of working (and very elegant) line - line intersections with either complete lines or line segment (see links) :

https://dl.dropboxusercontent.com/u/..._Corrected.xls (https://dl.dropboxusercontent.com/u/99937114/Forums/Eileens%20Lounge%20-%20LinearIntersect_Corrected.xls)

https://dl.dropboxusercontent.com/u/...0Intersect.xls (https://dl.dropboxusercontent.com/u/99937114/Forums/Eileens%20Lounge%20-%20ymxc%20Intersect.xls)

https://dl.dropboxusercontent.com/u/...tersection.xls (https://dl.dropboxusercontent.com/u/99937114/Forums/Listen%20Data%20-%20Intersection.xls)

https://dl.dropboxusercontent.com/u/...tersection.xls (https://dl.dropboxusercontent.com/u/99937114/Forums/AJP%20-%20ComplexIntersection.xls)

The problem I have is illustrated using the attached image. There is a defined line, starting at L1 (x,y) and finishing at L2 (x,y). There is no second line - instead there are the coordinates for another point (effectively L3) and an axis or angle of travel. I need to calculate the distance to and coordinates of the intersect if the point L3 was continued along the axis / angle of travel.

12674

It would also be useful to get the coordinates of a position when provided with an origin, a bearing and a distance e.g. x, y with a distance of 10m on a bearing of 195 degrees arrives you at x, y? This is effectively the same function, except the distance is defines vs calculating the distance and x, y of the intersection

Paul_Hossler
01-03-2015, 09:40 PM
I think this is right -- maybe not perfect but neither's my math anymore

P1 and P2 are the line end points of the first line

P3 is the other point

I used polar coordinates to get a P4 on the unit circle and this was the second point on the second line

So the intersection of the lines P1-P2 and P3-P4 gave me P5

The pythogrian theorem gave me the distance from P5 to P3

Good luck and hope this was a little helpful (and like I said I'm very rusty with this stuff)

theta
01-18-2015, 08:48 PM
Fantastic I will take a look and see. Works fine so far :)

Paul_Hossler
01-19-2015, 08:54 AM
If the logic is correct, a VBA solution is most likely possible by making a User Defined Function that you could use as a work sheet formula