Subject: Re: Distance on the sphere
Date: Mon, 23 Jun 1997 08:57:04 -0400
From: Alexander Bogomolny


Providing the algorithm is probably the best I can do. See if you can fill in the details.

  1. First of all, you must know formulas for spherical coordinates:

    x = r cos(f) sin(g)
    y = r sin(f) sin(g)
    z = r cos(g)

    where r is the radius of the sphere, f is the longitude, and g is the latitude of the point (x,y,z). The sphere is located with its center at the origin.

  2. Given two points a = (x1,y1,z1) and b = (x2,y2,z2) on the sphere, one can find the angle between them from two formulas for the scalar product:

    a.b = |a| |b| cos(i) = x1x2 + y1y2 + z1z2

    where |a| is the distance from a to the origin (the length of the corresponding vector), or sqrt(x12 + y12 + z12).

  3. Now, it's like on a circle. One has to find the length of an arc on a circle of radius r subtending a given central angle i which is given by

    length = i r

Alexander Bogomolny

|Reply| |Up|

Copyright © 1996-2018 Alexander Bogomolny [an error occurred while processing this directive]
[an error occurred while processing this directive]