choclo.utils.distance_spherical#
- choclo.utils.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_p
float
Longitude, 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_q
float
Longitude, latitude and radial coordinates of point \(\mathbf{q}\). Longitude and latitude must be in degrees. Radial coordinate should be in meters.
- longitude_p, latitude_p, radius_p
- Returns:
- distance
float
Euclidean distance between point \(\mathbf{p}\) and point \(\mathbf{q}\).
- distance
Notes
Given two points \(\mathbf{p} = (\lambda_p, \phi_p, r_p)\) and \(\mathbf{q} = (\lambda_q, \phi_q, r_q)\) defined in a spherical coordinate system \((\lambda, \phi, r)\), return the Euclidean (L2) distance between them:
\[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)\]and \(\lambda\) is the longitude angle, \(\phi\) the spherical latitude angle an \(r\) is the radial coordinate.