choclo.distance.distance_spherical

choclo.distance.distance_spherical#

choclo.distance.distance_spherical(longitude_p, latitude_p, radius_p, longitude_q, latitude_q, radius_q)[source]#

Euclidean distance between two points in spherical coordinates.

Important

All angles must be in degrees and radii in meters.

Parameters:
longitude_p, latitude_p, radius_pfloat

Longitude, geocentric latitude, and radial coordinates of point \(\mathbf{p}\). Longitude and latitude must be in degrees. Radial coordinate should be in meters.

longitude_q, latitude_q, radius_qfloat

Longitude, geocentric latitude, and radial coordinates of point \(\mathbf{q}\). Longitude and latitude must be in degrees. Radial coordinate should be in meters.

Returns:
distancefloat

Euclidean distance between point \(\mathbf{p}\) and point \(\mathbf{q}\) in meters.

Notes

Consider two points \(\mathbf{p} = (\lambda_p, \phi_p, r_p)\) and \(\mathbf{q} = (\lambda_q, \phi_q, r_q)\). Both are defined on a geocentric spherical coordinate system (\(\lambda\) is the longitude, \(\phi\) is the geocentric latitude, and \(r\) is the radius). The Euclidean (L2) distance between them is:

\[d = \sqrt{ (r_p - r_q) ^ 2 + 2 r_p r_q (1 - \cos\psi)},\]

where

\[\cos\psi = \sin\phi_p \sin\phi_q + \cos\phi_p \cos\phi_q \cos(\lambda_p - \lambda_q).\]