rfa 0.5.9

A port ERFA to Rust.
Documentation

use crate::utils::*;
///  P-vector to spherical coordinates.
///
///  Given:
///     p      double[3]    p-vector
///
///  Returned:
///     theta  double       longitude angle (radians)
///     phi    double       latitude angle (radians)
///
///  Notes:
///
///  1) The vector p can have any magnitude; only its direction is used.
///
///  2) If p is null, zero theta and phi are returned.
///
///  3) At either pole, zero theta is returned.
///
///  This revision:  2021 May 11
pub fn c2s(p: &[f64; 3], theta: &mut f64, phi: &mut f64)
{
 
 
    let x  = p[0];
    let y  = p[1];
    let z  = p[2];
    let d2 = x*x + y*y;
 
    *theta = if d2 == 0.0 {0.0} else{ atan2(y, x)};
    *phi =  if z == 0.0 {0.0} else { atan2(z, sqrt(d2))};
 
 /* Finished. */
 
 }