As used in the GeographyExample: '''Spherical coordinate system''' Let lat = the latitude of a point north of the equator. at the south pole, lat = -90 degrees at the equator, lat = 0 at the north pole, lat = 90 degrees Let long = the longitude of a point east of the prime meridian. 6 hours west of the prime meridian, long = -90 degrees at the prime meridian, long = 0 6 hours east of the prime meridian, long = 90 degrees '''Cartesian coordinate system''' Let x = the cartesian distance, from the center of the sphere, divided by the radius of the sphere. Looking down from the point (lat=0,long=0), x increases outward from the sphere. Let y = the cartesian distance, from the center of the sphere, divided by the radius of the sphere. Looking down from the point (lat=0,long=0), y increases to the east. Let z = the cartesian distance, from the center of the sphere, divided by the radius of the sphere. Looking down from the point (lat=0,long=0), z increases to the north. '''Some sample points''': (lat= 0, long= 0) = (x=1, y=0, z=0) = where equator crosses prime meridian (lat=90°, long= 0) = (x=0, y=0, z=1) = North Pole (lat= 0, long= 90°) = (x=0, y=1, z=0) = on equator, 6 hours east of prime meridian The '''distance between points on a sphere''' can be calculated as follows: Let tau = "tunnel distance" between two points, divided by the radius of the sphere. This is the shortest distance between two points, measured through the sphere, divided by the radius of the sphere. Let crow = distance as the crow flies between two points, measured along the great circle route between the points, divided by the radius of the sphere. x = cos(lat) * cos(long) y = cos(lat) * sin(long) z = sin(lat) lat = arcsin(z) long = tau^2 = (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2 tau^2 = 2 - 2 cos(crow) crow = arccos(1 - tau^2 / 2) ---- '''An example distance''', discussed in the GeographyExample: From (lat=45°, long= 0) = (x1=cos(45°), y1= 0, z1=sin(45°)) to (lat= 0°, long= 45°) = (x2=cos(45°), y2=sin(45°), z2= 0 ) tau^2 = (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2 tau^2 = (cos(45°) - cos(45°))^2 + (sin(45°) - 0)^2 + (0 - sin(45°))^2 tau^2 = ( 0 )^2 + sin(45°)^2 + ( - sin(45°))^2 tau^2 = sin(45°)^2 + sin(45°)^2 tau^2 = 1 crow = arccos(1 - tau^2 / 2) = arccos(1 - 1/2 ) = arccos( 1/2 ) = 60° ---- '''Proof that''' tau^2 = 2 - 2 cos(crow) Find the distance between points (lat=0, long=0) and (lat=0, long=crow): (lat=0, long=0) = (x=1, y=0, z=0) (lat=0, long=crow) = (x=cos(0)*cos(crow), y=cos(0)*sin(crow), z=sin(0)) = (x= 1 *cos(crow), y= 1 *sin(crow), z= 0 ) = (x=cos(crow), y=sin(crow), z=0) tau^2 = (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2 = (x2 - 1)^2 + y2^2 + z2^2 = (cos(crow) - 1)^2 + sin(crow)^2 + 0^2 = cos(crow)^2 - 2*cos(crow) + 1 + sin(crow)^2 + 0 = 1 + sin(crow)^2 + cos(crow)^2 - 2*cos(crow) = 1 + 1 - 2*cos(crow) = 2 - 2*cos(crow) ---- See also: GeographyExample