From 2557a11471ce1415d7984c82470343cd4c0ae2bf Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 16 Aug 2018 13:23:26 -0400 Subject: simplify wcs code --- tksao/frame/fitsimage.C | 7 ++++--- tksao/util/util.C | 31 ------------------------------- tksao/util/util.h | 3 --- 3 files changed, 4 insertions(+), 37 deletions(-) diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index 23d8e40..be7b449 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -2776,9 +2776,9 @@ Vector FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, if (!astOK || !checkWCS(out)) return Vector(); + astNorm(ast_, out.v); astEnd; - - return hasWCSCel(sys) ? zero360(radToDeg(out)) : out; + return hasWCSCel(sys) ? radToDeg(out) : out; } VectorStr FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, @@ -2820,9 +2820,10 @@ Vector3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, if (!astOK || !checkWCS(out)) return Vector3d(); + astNorm(ast_, out.v); astEnd; - return hasWCSCel(sys) ? zero360(radToDeg(out)) : out; + return hasWCSCel(sys) ? radToDeg(out) : out; } VectorStr3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, diff --git a/tksao/util/util.C b/tksao/util/util.C index 6475a6d..ba34dab 100644 --- a/tksao/util/util.C +++ b/tksao/util/util.C @@ -144,37 +144,6 @@ Vector3d zeroTWOPI(const Vector3d& vv) return out; } -double zero360(double aa) -{ - if (isnan(aa) || isinf(aa) || (aa == -DBL_MAX) || (aa == DBL_MAX)) - return NAN; - - double rr = aa; - if (rr>=0) - while (rr>360) - rr -= 360; - else - while (rr<0) - rr += 360; - return rr; -} - -Vector zero360(const Vector& vv) -{ - Vector out = vv; - // we want the first coord to be 0-360 - out[0] = zero360(out[0]); - return out; -} - -Vector3d zero360(const Vector3d& vv) -{ - Vector3d out = vv; - // we want the first coord to be 0-360 - out[0] = zero360(out[0]); - return out; -} - double m180To180(double aa) { if (isnan(aa) || isinf(aa) || (aa == -DBL_MAX) || (aa == DBL_MAX)) diff --git a/tksao/util/util.h b/tksao/util/util.h index 4728f2d..5a9a1fa 100644 --- a/tksao/util/util.h +++ b/tksao/util/util.h @@ -88,18 +88,15 @@ extern char* toConstLower(const char*); extern char* toConstUpper(const char*); extern double zeroTWOPI(double); -extern double zero360(double); extern double m180To180(double); extern double degToRad(double); extern double radToDeg(double); extern Vector zeroTWOPI(const Vector&); -extern Vector zero360(const Vector&); extern Vector degToRad(const Vector&); extern Vector radToDeg(const Vector&); extern Vector3d zeroTWOPI(const Vector3d&); -extern Vector3d zero360(const Vector3d&); extern Vector3d degToRad(const Vector3d&); extern Vector3d radToDeg(const Vector3d&); -- cgit v0.12