char * v3fmt(V3 v) { char *p; /* get a buffer */ p = v3buf[nxtv3buf++]; nxtv3buf %= NV3BUF; if (v3GetType(v) == CARTESIAN) { (void)sprintf(p, "%22.15e %22.15e %22.15e", v3GetX(v), v3GetY(v), v3GetZ(v)); } else { (void)sprintf(p, "%22.15e %22.15e %22.15e", v3GetR(v), v3GetAlpha(v), v3GetDelta(v)); } return(p); }
double v3alpha(V3 v) { double alpha; if (v3GetType(v) == CARTESIAN) { v = v3c2s(v); } alpha = v3GetAlpha(v); if (v3GetR(v) < 0.0) { alpha += M_PI; } if (alpha < 0.0) { alpha += ceil(alpha / (-2 * M_PI)) * (2 * M_PI); } if (alpha >= (2 * M_PI)) { alpha -= floor(alpha / (2 * M_PI)) * (2 * M_PI); } return(alpha); }