# Thread: Point of intersection of two lines...

1. ## Point of intersection of two lines...

Point of intersection of two lines on an ellipsoid. I searched the forums and was unable to find a similar topic. I am trying to figure out the intersection point of two lines (arcs) on an ellipsoid. I have all the parameters of the ellipsoid (which is actually the earth) and the starting and ending points of the two lines (based on lat/lon). Can anyone help me out with this? Thanks

2. Originally Posted by pbhuter
...on an ellipsoid. I searched the forums and was unable to find a similar topic. I am trying to figure out the intersection point of two lines (arcs) on an ellipsoid. I have all the parameters of the ellipsoid (which is actually the earth) and the starting and ending points of the two lines (based on lat/lon). Can anyone help me out with this? Thanks
What are your parameters for the ellipsoid?
Are you using Clark's 66, Mead, WGS 83 ...

There are too many different ellipsoid definitions to attempt to describe a specific algorithm.
If given a longitude and latitude, you have the intersection.

Unless:

Line 1: Starts at (Lat1s,Lon1s) and ends at (Lat1e,Lon1e)
Line 2: Starts at (Lat2s,Lon2s) and ends at (Lat2e,Lon2e)

If that is the case, I have found the easiest way is to convert the geographic coordinates to Lambert conformal or mercator value and then solve.

3. I am using WGS-84 for my ellipse, so a = 6378137 m and b = 6356752.3142 m and f = 1/298.257223563. Lat/lon are in the same coordinate system (WGS-84), say arc 1 goes from 55.75/115.76 to 38.25/-118.45 and arc 2 goes from 41.85/-119.26 to 37.74/-118.42, I need to know if these two arc intersect, and if so, where. *Note, those are just made up arcs, I am in need of an algorithm for figuring this out which I will then convert to code that will take in the four coordinates and solve. Thank you.

4. Rather than copy/paste the code [which might violate some copyright] take at look at this:

Problem 1E. Calculate the intersection of two paths given the starting and ending coordinates for each path.

This article & code is for the intersection of two arcs. There is information about both spheres and ellipsoids.

It can be found at this internet location:
http://www.codeguru.com/cpp/cpp/algorithms/article.php/c5115

If that direct link is not allowed I will re-work the link.

5. Thank you for the link. I looked at the information and the code, and unfortunately it appears that it provides information for finding the intersection on a sphere only. The ellipsoid stuff deals with finding the distance between two points on an ellipsoid. I'm thinking that I'll end up having to use calculus in some way and integrate over the surface of the ellipsoid, but I'm unsure of how to go about putting in the parameters of the surface. I'll try putting a post under calculs and see if anyone there can give me a hand. Thanks again.

6. ## Intersection of two arcs on an ellipsoid

I believe that I need to use calculus in order to solve for the intersection point of two arcs on an ellipsoid, so I'm putting this question in here (I have a similar question under advanced geometry). I have an ellipsoid (the earth) and two arcs (each defined by two lat/lon coordinates). I need to figure out where these two arcs intersect on the surface of the ellipsoid (if they intersect, that is). I have done some searching, and I think that because the surface of the ellipsoid is not the same in any given direction (as a sphere is), that I must integrate over the surface, I am unsure of how to go about putting the parameters of the ellipsoid into an algorithm, or really what the algorithm should look like. Any help would be appreciated. Thank you.

7. ## Naivete

I'm sorry, I may be naive here, but won't these two arcs be expressible as planes in 3-space cutting the ellipsoid? Can't you use three points on each arc to calculate their planar equations, find their line of intersection (if it exists) and find where the line intersects the ellipsoid? Sounds like simple geometry, but perhaps I am visualizing wrong. Do you have a sample problem?

8. ## The Nitty-Gritty

Eqn of Ellipsoid: $\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}=1$

Eqn of Latitude: $z=h$ for some constant (proportional to the angle of latitude, $\alpha$).

Eqn of Longitude: $[x,y,z]*[\cos\beta, \sin\beta, 0]=0$

So... Eqn of Line: $[x,y,z]=[0,0,h]+t[\cos\beta, \sin\beta, 0]$

Intersect with Ellipsoid... $\frac{t^2\cos^2\beta}{a^2}+\frac{t^2\sin^2\beta}{b ^2}+\frac{h^2}{c^2}=1$

Solving... $t=\pm\sqrt{(1-\frac{h^2}{a^2})(\frac{\cos^2\beta}{a^2}+\frac{\si n^2\beta}{b^2})^{-1}}$