summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-12-01 18:02:18 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-12-01 18:02:18 (GMT)
commit7e1bcfefcc5bde053141e8d9b5fd97b38c1c3bc7 (patch)
tree93a3ecd61bf68f6c53ccb54fbcfddb2703620ac8
parentb9c93b15c27c7b9fd2b0e19a56741498646d3444 (diff)
downloadblt-7e1bcfefcc5bde053141e8d9b5fd97b38c1c3bc7.zip
blt-7e1bcfefcc5bde053141e8d9b5fd97b38c1c3bc7.tar.gz
blt-7e1bcfefcc5bde053141e8d9b5fd97b38c1c3bc7.tar.bz2
update AST WCS
-rw-r--r--tksao/util/util.C50
-rw-r--r--tksao/util/util.h9
-rw-r--r--tksao/vector/vector.C23
-rw-r--r--tksao/vector/vector.h3
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&);