summaryrefslogtreecommitdiffstats
path: root/tksao/frame
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-08-16 20:37:55 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-08-16 20:37:55 (GMT)
commite45aee40eb4f7837acae8808dd2343dad32f9fe0 (patch)
treec7ab0e58cae22259046bf9cd21d12db6025b5213 /tksao/frame
parent4ea7342aad40acc50b455dc6ed1d2d9c3154588e (diff)
downloadblt-e45aee40eb4f7837acae8808dd2343dad32f9fe0.zip
blt-e45aee40eb4f7837acae8808dd2343dad32f9fe0.tar.gz
blt-e45aee40eb4f7837acae8808dd2343dad32f9fe0.tar.bz2
simplify wcs code
Diffstat (limited to 'tksao/frame')
-rw-r--r--tksao/frame/basecommand.C13
-rw-r--r--tksao/frame/fitsimage.C39
2 files changed, 21 insertions, 31 deletions
diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C
index b3ad310..bc9a97d 100644
--- a/tksao/frame/basecommand.C
+++ b/tksao/frame/basecommand.C
@@ -1783,16 +1783,11 @@ void Base::getFitsSliceCmd(int id, Coord::CoordSystem sys)
{
if (currentContext->fits) {
int ss = currentContext->slice(id);
- /*
+
FitsImage* ptr = currentContext->fits;
- Vector cc = ptr->center();
- Vector3d dd = Vector3d(cc,ss) * Translate3d(-.5,-.5,-.5);
- cerr << ptr->mapFromRef(dd,sys,Coord::FK5,Coord::SEXAGESIMAL)
- << '='
- << ptr->mapFromRef(dd,sys)
- << '='
- << ptr->mapFromImage3d(ss,sys) << endl;
- */
+ // Vector cc = ptr->center();
+ // Vector3d dd = Vector3d(cc,ss) * Translate3d(-.5,-.5,-.5);
+ // cerr << ptr->mapFromRef(dd,sys,Coord::FK5,Coord::SEXAGESIMAL) << endl;
printDouble(currentContext->fits->mapFromImage3d(ss,sys));
}
else
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index 0504708..56eb36b 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -2820,7 +2820,6 @@ Vector3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys,
Vector3d out = wcsTran(ast_, in, 1);
if (!astOK || !checkWCS(out))
return Vector3d();
-
astNorm(ast_, out.v);
astEnd;
@@ -2839,7 +2838,7 @@ VectorStr3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys,
setWCSSystem(sys);
setWCSSkyFrame(sky);
- Vector out = wcsTran(ast_, in, 1);
+ Vector3d out = wcsTran(ast_, in, 1);
if (!astOK || !checkWCS(out))
return VectorStr3d();
@@ -3223,10 +3222,10 @@ Vector FitsImage::vRadToDeg(const Vector& vv, Coord::CoordSystem sys)
Vector out = vv;
if (hasWCSCel(sys)) {
int id = sys-Coord::WCS;
- if (wcsCelLon_[id] == 1 || wcsCelLat_[id] == 1)
- out[0] = radToDeg(out[0]);
- if (wcsCelLon_[id] == 2 || wcsCelLat_[id] == 2)
- out[1] = radToDeg(out[1]);
+ for (int ii=0; ii<2; ii++) {
+ if (wcsCelLon_[id] == ii+1 || wcsCelLat_[id] == ii+1)
+ out[ii] = radToDeg(out[ii]);
+ }
}
return out;
}
@@ -3236,12 +3235,10 @@ Vector3d FitsImage::vRadToDeg(const Vector3d& vv, Coord::CoordSystem sys)
Vector3d out = vv;
if (hasWCSCel(sys)) {
int id = sys-Coord::WCS;
- if (wcsCelLon_[id] == 1 || wcsCelLat_[id] == 1)
- out[0] = radToDeg(out[0]);
- if (wcsCelLon_[id] == 2 || wcsCelLat_[id] == 2)
- out[1] = radToDeg(out[1]);
- if (wcsCelLon_[id] == 2 || wcsCelLat_[id] == 2)
- out[2] = radToDeg(out[2]);
+ for (int ii=0; ii<3; ii++) {
+ if (wcsCelLon_[id] == ii+1 || wcsCelLat_[id] == ii+1)
+ out[ii] = radToDeg(out[ii]);
+ }
}
return out;
}
@@ -3251,10 +3248,10 @@ Vector FitsImage::vDegToRad(const Vector& vv, Coord::CoordSystem sys)
Vector out = vv;
if (hasWCSCel(sys)) {
int id = sys-Coord::WCS;
- if (wcsCelLon_[id] == 1 || wcsCelLat_[id] == 1)
- out[0] = degToRad(out[0]);
- if (wcsCelLon_[id] == 2 || wcsCelLat_[id] == 2)
- out[1] = degToRad(out[1]);
+ for (int ii=0; ii<2; ii++) {
+ if (wcsCelLon_[id] == ii+1 || wcsCelLat_[id] == ii+1)
+ out[ii] = degToRad(out[ii]);
+ }
}
return out;
}
@@ -3264,12 +3261,10 @@ Vector3d FitsImage::vDegToRad(const Vector3d& vv, Coord::CoordSystem sys)
Vector3d out = vv;
if (hasWCSCel(sys)) {
int id = sys-Coord::WCS;
- if (wcsCelLon_[id] == 1 || wcsCelLat_[id] == 1)
- out[0] = degToRad(out[0]);
- if (wcsCelLon_[id] == 2 || wcsCelLat_[id] == 2)
- out[1] = degToRad(out[1]);
- if (wcsCelLon_[id] == 2 || wcsCelLat_[id] == 2)
- out[2] = degToRad(out[2]);
+ for (int ii=0; ii<3; ii++) {
+ if (wcsCelLon_[id] == ii+1 || wcsCelLat_[id] == ii+1)
+ out[ii] = degToRad(out[ii]);
+ }
}
return out;
}