From 7e1bcfefcc5bde053141e8d9b5fd97b38c1c3bc7 Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 1 Dec 2017 13:02:18 -0500 Subject: update AST WCS --- tksao/util/util.C | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ tksao/util/util.h | 9 +++++++++ tksao/vector/vector.C | 23 ----------------------- tksao/vector/vector.h | 3 --- 4 files changed, 59 insertions(+), 26 deletions(-) diff --git a/tksao/util/util.C b/tksao/util/util.C index 052aa27..edae5c6 100644 --- a/tksao/util/util.C +++ b/tksao/util/util.C @@ -128,6 +128,22 @@ double zeroTWOPI(double aa) return rr; } +Vector zeroTWOPI(const Vector& vv) +{ + Vector out = vv; + // we want the first coord to be 0-2Pi + out[0] = zeroTWOPI(out[0]); + return out; +} + +Vector3d zeroTWOPI(const Vector3d& vv) +{ + Vector3d out = vv; + // we want the first coord to be 0-2Pi + out[0] = zeroTWOPI(out[0]); + return out; +} + double zero360(double aa) { if (isnan(aa) || isinf(aa) || (aa == -DBL_MAX) || (aa == DBL_MAX)) @@ -173,6 +189,40 @@ double radToDeg(double aa) return zero360(dd); } +Vector radToDeg(const Vector& vv) +{ + Vector out = vv; + // we want the first coord to be 0-360 + out[0] = radToDeg(out[0]); + out[1] *= 180./M_PI; + return out; +} + +Vector3d radToDeg(const Vector3d& vv) +{ + Vector3d out = vv; + // we want the first coord to be 0-360 + out[0] = radToDeg(out[0]); + out[1] *= 180./M_PI; + return out; +} + +Vector degToRad(const Vector& vv) +{ + Vector out =vv; + out[0] *= M_PI/180.; + out[1] *= M_PI/180.; + return out; +} + +Vector3d degToRad(const Vector3d& vv) +{ + Vector3d out =vv; + out[0] *= M_PI/180.; + out[1] *= M_PI/180.; + return out; +} + double dmsToDegree(int sign, int degree, int min, double sec) { // sign is needed because of -00 vs +00 diff --git a/tksao/util/util.h b/tksao/util/util.h index 7b91e6a..5af2ee4 100644 --- a/tksao/util/util.h +++ b/tksao/util/util.h @@ -21,6 +21,7 @@ using namespace std; #include "fuzzy.h" #include "vector.h" +#include "vector3d.h" #ifndef PATH_MAX #define PATH_MAX 1024 @@ -92,6 +93,14 @@ extern double m180To180(double); extern double degToRad(double); extern double radToDeg(double); +extern Vector zeroTWOPI(const Vector&); +extern Vector degToRad(const Vector&); +extern Vector radToDeg(const Vector&); + +extern Vector3d zeroTWOPI(const Vector3d&); +extern Vector3d degToRad(const Vector3d&); +extern Vector3d radToDeg(const Vector3d&); + extern int parseSection(char*, Vector*, Vector*); extern double dmsToDegree(int, int, int, double); diff --git a/tksao/vector/vector.C b/tksao/vector/vector.C index 45832ac..194aca5 100644 --- a/tksao/vector/vector.C +++ b/tksao/vector/vector.C @@ -7,7 +7,6 @@ #include "vector.h" #include "vector3d.h" #include "fuzzy.h" -#include "util.h" // Vector::manip @@ -45,28 +44,6 @@ Vector& Vector::clip(const BBox& bb) return *this; } -Vector& Vector::radToDeg() -{ - // we want the first coord to be 0-360 - v[0] = ::radToDeg(v[0]); - v[1] *= 180./M_PI; - return *this; -} - -Vector& Vector::degToRad() -{ - v[0] *= M_PI/180.; - v[1] *= M_PI/180.; - return *this; -} - -Vector& Vector::zeroTWOPI() -{ - // we want the first coord to be 0-2Pi - v[0] = ::zeroTWOPI(v[0]); - return *this; -} - Vector Vector::TkCanvasPs(void* canvas) { return Vector(v[0], Tk_CanvasPsY((Tk_Canvas)canvas, v[1])); diff --git a/tksao/vector/vector.h b/tksao/vector/vector.h index 915c81c..fc83648 100644 --- a/tksao/vector/vector.h +++ b/tksao/vector/vector.h @@ -74,9 +74,6 @@ class Vector { Vector normalize() {double d = sqrt(v[0]*v[0]+v[1]*v[1]); return d ? Vector(v[0]/d,v[1]/d) : Vector();} - Vector& radToDeg(); - Vector& degToRad(); - Vector& zeroTWOPI(); // restrict vector by bbox Vector& clip(const BBox&); -- cgit v0.12