summaryrefslogtreecommitdiffstats
path: root/tksao/util
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 /tksao/util
parentb9c93b15c27c7b9fd2b0e19a56741498646d3444 (diff)
downloadblt-7e1bcfefcc5bde053141e8d9b5fd97b38c1c3bc7.zip
blt-7e1bcfefcc5bde053141e8d9b5fd97b38c1c3bc7.tar.gz
blt-7e1bcfefcc5bde053141e8d9b5fd97b38c1c3bc7.tar.bz2
update AST WCS
Diffstat (limited to 'tksao/util')
-rw-r--r--tksao/util/util.C50
-rw-r--r--tksao/util/util.h9
2 files changed, 59 insertions, 0 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);