public Spherical Dc62s(Cartesian v) {
        double x, y, z, xd, yd, zd, rxy2, rxy, r2, xyp;
        double a, b, r, ad, bd, rd;

        TRACE("Dc62s");
        /* Components of position/velocity vector. */
        x = v.getX();
        y = v.getY();
        z = v.getZ();
        xd = v.getXvel();
        yd = v.getYvel();
        zd = v.getZvel();

        /* Component of R in XY plane squared. */
        rxy2 = x * x + y * y;

        /* Modulus squared, with protection against null vector. */
        if ((r2 = rxy2 + z * z) == 0.0) {
            x = xd;
            y = yd;
            z = zd;
            rxy2 = x * x + y * y;
            r2 = rxy2 + z * z;
        }

        /* Position and velocity in spherical coordinates. */
        rxy = Math.sqrt(rxy2);
        xyp = x * xd + y * yd;
        if (rxy2 != 0.0) {
            a = Math.atan2(y, x);
            b = Math.atan2(z, rxy);
            ad = (x * yd - y * xd) / rxy2;
            bd = (zd * rxy2 - z * xyp) / (r2 * rxy);
        } else {
            a = 0.0;
            b = (z != 0.0) ? Math.atan2(z, rxy) : 0.0;
            ad = 0.0;
            bd = 0.0;
        }
        rd = ((r = Math.sqrt(r2)) != 0.0) ? (xyp + z * zd) / (r) : 0.0;
        ENDTRACE("Dc62s");
        return new Spherical(a, b, r, ad, bd, rd);
    }