nl_tokens: convertCart2Sph converts arrays of cartesian vectors to spherical coordinates
pl_tokens: function ( xyz , OMIT_MAG ) { var azi , elev , r ; var aziElevR = <mask> Array ( xyz . length ) ; for ( var i = 0 ; i < xyz . length ; i ++ ) { azi = Math . atan2 ( xyz [ i ] [ 1 ] , xyz [ i ] [ 0 ] ) ; elev = Math . atan2 ( xyz [ i ] [ 2 ] , Math . sqrt ( xyz [ i ] [ 0 ] * xyz [ i ] [ 0 ] + xyz [ i ] [ 1 ] * xyz [ i ] [ 1 ] ) ) ; if ( OMIT_MAG == 1 ) { aziElevR [ i ] = [ azi , elev ] ; } else { r = Math . sqrt ( xyz [ i ] [ 0 ] * xyz [ i ] [ 0 ] + xyz [ i ] [ 1 ] * xyz [ i ] [ 1 ] + xyz [ i ] [ 2 ] * xyz [ i ] [ 2 ] ) ; aziElevR [ i ] = [ azi , elev , r ] ; } } return aziElevR ; }