Assuming the earth is a perfect sphere, is there a way to find out the straight line distance (which goes through the earth) between any 2 points on the surface of the earth? I've tried searching for this on Google, but it keeps showing me the Great Circle Distance which is the shortest distance on the surface of the earth, but not through the earth.
-
3If you imagine the Earth as a sphere hanging in $3$D space with centre at the origin, and you know the coordinates of your two points, then just use the distance formula – Chubby Chef Dec 16 '20 at 16:06
-
1If you know the coordinate of your points, $A(x_A,y_A,z_A)$ and $B(x_B,y_B,z_B)$, then it is simply the Euclidian distance $\sqrt{(x_B-x_A)^2+(y_B-y_A)^2+(z_B-z_A)^2}$. – Alain Remillard Dec 16 '20 at 16:06
-
1How are the points given to you? XYZ, latitude and longitude, or what? – Rob Arthan Dec 16 '20 at 16:09
2 Answers
The sphere is actually a red herring here. Because your movement is not impeded by the sphere, this question is equivalent to finding the shortest distance between two points $P(a,b,c)$ and $Q(x,y,z)$. Do you know what to do from here?
- 19,636
-
-
Then how come the answer on https://math.stackexchange.com/questions/914792/the-shortest-distance-between-2-points-on-the-earth is different. I think the question is somewhat the same. Unless I understood the question wrongly – prata Dec 16 '20 at 16:23
-
@BrienLim The question you link to is about the average distance between two randomly chosen points on a sphere. This is much more involved. Although the distance formula still applies, it is only used to solve one component of a much larger problem. – Joe Dec 16 '20 at 16:27
-
-
1@BrienLim You appear to be asking for how to find the distance between any two points on a sphere. This is not the same as randomly generating many points, and averaging their differences. Imagine you try to work out how many pages there are between two pages in a book. This is easy. Then consider the question of what the average number of pages between two randomly selected pages is. Not so easy... – Joe Dec 16 '20 at 16:33
-
1@BrienLim Or think about the number of spaces between two people standing in a queue. If you know where two people are standing, then it is easy to find the distance between them. But trying to work out the average distance between two randomly selected people is much trickier. – Joe Dec 16 '20 at 16:34
-
If your points are given by longitude $\varphi$ and latitude $\theta$, and if $r$ is the radius of the Earth, then this gives you the spherical co-ordinates of the point on the surface.
The Cartesian co-ordinates of that point (assuming a suitably placed co-ordinate system so that the origin is in the centre of the Earth and the $z$ axis goes through the poles) can be then obtained from the spherical co-ordinates using the formula(e):
$$(x,y,z)=(r\cos\varphi\cos\theta, r\sin\varphi\cos\theta, r\sin\theta)$$
and now you can use the ordinary (Euclidean) distance between two points:
$$d((x_1,y_1,z_1),(x_2,y_2,z_2))=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$$