Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
Heard about geodesics? The two points on any surface can be connected by a geodesics. For example, if the surface happens to be a plan, the geodesics will be a straight line connecting the two points. Then the lenghth of the segment of the curve will be the distance.
Usually, for any surface, getting the geodesics amounts to solve a bunch of ODE's, which sounds like a daunting job. Fortunately, it's pretty simple to get geodesics on a sphere, which are called "grand circles". Furthermore, for any two points on the sphere of radius r, the distance can be obtained by integrating
ds^2=r^2 * (dtheta^2 + (sin(theta))^2 * dphi^2)
where (t, phi, theta) is the sphere coordinate.
So, here is what you should. First, choose your sphere coordinate system and then transform the latitudes and the longitudes to sphere coordinates. The second step is to construct a relationship between theta and phi. Notice that if your sphere system is chosen properly, this relation could be as simple as an equation for a straight line. The last step to integrate the differential relation above, which essentially is just calculating the length of a piece of arc.
If you want to do some math on your own, remember that this is a spherical problem and you can represent the points in vector notation. Then get the angle between them, convert the angle to radians and multiply by the earth's radius.
Oh, boy, those we have done may be overkills. Here might be a better and simple way to resolve the specific issue (only works for sphere). Latitude and Longitude are essentially sphere coordinates (except a possible shift for latitude). From them you can get the cartesian coordinates. Assume that the (cartesian) coordinates of the two points are p1=(x1,y1,z1) and p2=(x2,y2,z2). Then the inner product of the two vectors shows
cos(angle)=p1*p2/(|p1|*|p2|)
Therefore, angle=acos(p1*p2/(|p1|*|p2|)). Thus the distance=angle*r, where r is the radius of the earth.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.