Method code for $math.rectangular_spherical()

[Turn off line numbering]
  1: arg coords;
  2: var a, d;
  3: 
  4: a = atan2(coords[2], coords[1]);
  5: if (a < 0)
  6:     a += pi2;
  7: return [(d = .distance(coords, origin_3d)), a, atan2(coords[3], .distance(coords.subrange(1, 2), origin_2d))];

// Miroslav Silovic
// Created 19-Oct-1996 as a part of ColdCore, see: @help Credit

Tlon