summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-01-27 20:14:07 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-01-27 20:14:07 (GMT)
commitce11bec2ee5edfd25cb9c15abcd1f57858814a3e (patch)
tree3f27950904939cf897cb1b44e8db18fd1216d214
parent8b8dee3f4ced968e1fed3458060c529bfc5b8e62 (diff)
downloadblt-ce11bec2ee5edfd25cb9c15abcd1f57858814a3e.zip
blt-ce11bec2ee5edfd25cb9c15abcd1f57858814a3e.tar.gz
blt-ce11bec2ee5edfd25cb9c15abcd1f57858814a3e.tar.bz2
redefine degToRad
-rw-r--r--tksao/frame/fitsimage.C8
-rw-r--r--tksao/frame/fitsmap.C3
-rw-r--r--tksao/frame/fr3dcommand.C4
-rw-r--r--tksao/frame/frmarker.C28
-rw-r--r--tksao/frame/frmarkerxml.C5
-rw-r--r--tksao/util/util.C6
6 files changed, 28 insertions, 26 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index dc2f346..b78fd22 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -1654,18 +1654,18 @@ void FitsImage::match(const char* xxname1, const char* yyname1,
for (int ii=0; ii<nxx2; ii++)
ptr2[ii] = degToRad(Vector(ixx2[ii],iyy2[ii]));
- double rr;
+ double rr = rad;
switch (dist) {
case Coord::DEGREE:
- rr = degToRad(rad);
break;
case Coord::ARCMIN:
- rr = degToRad(rad/60.);
+ rr /= 60.;
break;
case Coord::ARCSEC:
- rr = degToRad(rad/60./60.);
+ rr /= 60.*60.;
break;
}
+ rr = zeroTWOPI(degToRad(rr));
Vector* ptr1 =NULL;
if (sky1 != sky2) {
diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C
index a4ff6e4..1d8072e 100644
--- a/tksao/frame/fitsmap.C
+++ b/tksao/frame/fitsmap.C
@@ -314,7 +314,7 @@ double FitsImage::mapLenToRef(double dd, Coord::CoordSystem sys,
double rdd = dd;
if (hasWCSCel(sys)) {
- rdd = degToRad(dd);
+ rdd = dd;
switch (dist) {
case Coord::DEGREE:
break;
@@ -325,6 +325,7 @@ double FitsImage::mapLenToRef(double dd, Coord::CoordSystem sys,
rdd /= 60.*60.;
break;
}
+ rdd = degToRad(rdd); // no zeroTWOPI since this is a length
}
Vector cc = center();
diff --git a/tksao/frame/fr3dcommand.C b/tksao/frame/fr3dcommand.C
index e4621da..e37af01 100644
--- a/tksao/frame/fr3dcommand.C
+++ b/tksao/frame/fr3dcommand.C
@@ -519,8 +519,8 @@ void Frame3dBase::set3dScaleCmd(double ss)
void Frame3dBase::set3dViewCmd(float az, float el)
{
- az_ = degToRad(az);
- el_ = degToRad(el);
+ az_ = zeroTWOPI(degToRad(az));
+ el_ = zeroTWOPI(degToRad(el));
preservecache_ =1;
update(MATRIX);
}
diff --git a/tksao/frame/frmarker.C b/tksao/frame/frmarker.C
index 7474a78..9e18866 100644
--- a/tksao/frame/frmarker.C
+++ b/tksao/frame/frmarker.C
@@ -3213,7 +3213,7 @@ void Base::markerBpandaEditCmd(int id,
++acnt;
}
for (int i=0; i<acnt; i++)
- angles[i] = mapAngleToRef(degToRad(angles[i]),sys,sky);
+ angles[i] = mapAngleToRef(zeroTWOPI(degToRad(angles[i])),sys,sky);
int rcnt = 0;
Vector radii[MAXANNULI];
@@ -3761,7 +3761,7 @@ void Base::markerCpandaEditCmd(int id, const char* a, const char* r,
}
{
for (int i=0; i<acnt; i++)
- angles[i] = mapAngleToRef(degToRad(angles[i]),sys,sky);
+ angles[i] = mapAngleToRef(zeroTWOPI(degToRad(angles[i])),sys,sky);
}
int rcnt = 0;
Vector radii[MAXANNULI];
@@ -4367,7 +4367,7 @@ void Base::markerEpandaEditCmd(int id,
++acnt;
}
for (int i=0; i<acnt; i++)
- angles[i] = mapAngleToRef(degToRad(angles[i]),sys,sky);
+ angles[i] = mapAngleToRef(zeroTWOPI(degToRad(angles[i])),sys,sky);
int rcnt = 0;
Vector radii[MAXANNULI];
@@ -5024,7 +5024,7 @@ void Base::markerLoadFitsCmd(const char* fn, const char* color,
Vector rr(r->value(ptr,0),r->value(ptr,1));
createBoxCmd(keyContext->fits->mapToRef(center, Coord::PHYSICAL),
keyContext->fits->mapLenToRef(rr, Coord::PHYSICAL),
- degToRad(ang->value(ptr)), 0,
+ zeroTWOPI(degToRad(ang->value(ptr))), 0,
color, dash, width, font, text, props, NULL, taglist,cblist);
}
@@ -5041,7 +5041,7 @@ void Base::markerLoadFitsCmd(const char* fn, const char* color,
Vector rr(r->value(ptr,0),r->value(ptr,1));
createBoxCmd(keyContext->fits->mapToRef(center, Coord::PHYSICAL),
keyContext->fits->mapLenToRef(rr, Coord::PHYSICAL),
- degToRad(ang->value(ptr)), 0,
+ zeroTWOPI(degToRad(ang->value(ptr))), 0,
color, dash, width, font, text, props, NULL, taglist,cblist);
}
else if (!strncmp(s2, "RECTAN", 6)) {
@@ -5066,7 +5066,7 @@ void Base::markerLoadFitsCmd(const char* fn, const char* color,
createBoxCmd(keyContext->fits->mapToRef(c,Coord::PHYSICAL),
keyContext->fits->mapLenToRef(d,Coord::PHYSICAL),
- degToRad(ang->value(ptr)), 0,
+ zeroTWOPI(degToRad(ang->value(ptr))), 0,
color, dash, width, font, text, props, NULL, taglist,cblist);
}
@@ -5074,7 +5074,7 @@ void Base::markerLoadFitsCmd(const char* fn, const char* color,
Vector rr(r->value(ptr,0),r->value(ptr,1));
createEllipseCmd(keyContext->fits->mapToRef(center, Coord::PHYSICAL),
keyContext->fits->mapLenToRef(rr, Coord::PHYSICAL),
- degToRad(ang->value(ptr)), 0,
+ zeroTWOPI(degToRad(ang->value(ptr))), 0,
color, dash, width, font, text, props, NULL, taglist,cblist);
}
@@ -5082,9 +5082,12 @@ void Base::markerLoadFitsCmd(const char* fn, const char* color,
Vector rr0(r->value(ptr,0),0);
Vector rr1(r->value(ptr,1),0);
createCpandaCmd(keyContext->fits->mapToRef(center,Coord::PHYSICAL),
- degToRad(ang->value(ptr,0)),degToRad(ang->value(ptr,1)),1,
+ zeroTWOPI(degToRad(ang->value(ptr,0))),
+ zeroTWOPI(degToRad(ang->value(ptr,1))),
+ 1,
keyContext->fits->mapLenToRef(rr0[0],Coord::PHYSICAL),
- keyContext->fits->mapLenToRef(rr1[0],Coord::PHYSICAL), 1,
+ keyContext->fits->mapLenToRef(rr1[0],Coord::PHYSICAL),
+ 1,
color, dash, width, font, text, props, NULL, taglist,cblist);
}
@@ -5092,9 +5095,12 @@ void Base::markerLoadFitsCmd(const char* fn, const char* color,
Vector rr0(r->value(ptr,0),r->value(ptr,1));
Vector rr1(r->value(ptr,2),r->value(ptr,3));
createEpandaCmd(keyContext->fits->mapToRef(center,Coord::PHYSICAL),
- degToRad(ang->value(ptr,0)),degToRad(ang->value(ptr,1)),1,
+ zeroTWOPI(degToRad(ang->value(ptr,0))),
+ zeroTWOPI(degToRad(ang->value(ptr,1))),
+ 1,
keyContext->fits->mapLenToRef(rr0,Coord::PHYSICAL),
- keyContext->fits->mapLenToRef(rr1,Coord::PHYSICAL), 1,
+ keyContext->fits->mapLenToRef(rr1,Coord::PHYSICAL),
+ 1,
0,
color, dash, width, font, text, props, NULL, taglist,cblist);
diff --git a/tksao/frame/frmarkerxml.C b/tksao/frame/frmarkerxml.C
index cf80c33..67e44a8 100644
--- a/tksao/frame/frmarkerxml.C
+++ b/tksao/frame/frmarkerxml.C
@@ -970,7 +970,7 @@ double Base::xmlAngle(const char* angle, int sign, double offset,
{
switch (format) {
case Coord::DEG:
- return mapAngleToRef(sign*degToRad(atof(angle))+offset, sys, sky);
+ return mapAngleToRef(sign*zeroTWOPI(degToRad(atof(angle)))+offset,sys,sky);
case Coord::RAD:
return mapAngleToRef(sign*atof(angle)+offset, sys, sky);
}
@@ -987,7 +987,8 @@ double* Base::xmlAngles(const char* angle, int sign, double offset, int cnt,
if (tok)
switch (format) {
case Coord::DEG:
- ang[ii] = mapAngleToRef(sign*degToRad(atof(tok))+offset, sys, sky);
+ ang[ii] =
+ mapAngleToRef(sign*zeroTWOPI(degToRad(atof(tok)))+offset,sys,sky);
break;
case Coord::RAD:
ang[ii] = mapAngleToRef(sign*atof(tok)+offset, sys, sky);
diff --git a/tksao/util/util.C b/tksao/util/util.C
index dedaba9..5e4ab87 100644
--- a/tksao/util/util.C
+++ b/tksao/util/util.C
@@ -173,9 +173,6 @@ double m180To180(double aa)
double radToDeg(double aa)
{
- if (isnan(aa) || isinf(aa) || (aa == -DBL_MAX) || (aa == DBL_MAX))
- return NAN;
-
double dd = 180.*aa/M_PI;
return zero360(dd);
}
@@ -200,9 +197,6 @@ Vector3d radToDeg(const Vector3d& vv)
double degToRad(double aa)
{
- if (isnan(aa) || isinf(aa) || (aa == -DBL_MAX) || (aa == DBL_MAX))
- return NAN;
-
double rr = M_PI*aa/180.;
return zeroTWOPI(rr);
}