summaryrefslogtreecommitdiffstats
path: root/tksao/frame/fitsmap.C
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-07-27 17:44:28 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-07-27 17:44:28 (GMT)
commitcf5a14e2056c195269bc1eefa7553f7389aa13cf (patch)
tree81f2c19eb4b443f12b39757674da627b964bba32 /tksao/frame/fitsmap.C
parent88340b6c53f5d9f9c7cc721c1911657964462504 (diff)
downloadblt-cf5a14e2056c195269bc1eefa7553f7389aa13cf.zip
blt-cf5a14e2056c195269bc1eefa7553f7389aa13cf.tar.gz
blt-cf5a14e2056c195269bc1eefa7553f7389aa13cf.tar.bz2
simplify mapLen code
Diffstat (limited to 'tksao/frame/fitsmap.C')
-rw-r--r--tksao/frame/fitsmap.C50
1 files changed, 15 insertions, 35 deletions
diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C
index e1cc229..17352f1 100644
--- a/tksao/frame/fitsmap.C
+++ b/tksao/frame/fitsmap.C
@@ -247,14 +247,14 @@ Vector FitsImage::mapLenFromRef(const Vector& vv, Coord::CoordSystem sys,
}
#endif
-#ifdef OLDWCS
double FitsImage::mapLenToRef(double dd, Coord::CoordSystem sys,
Coord::DistFormat dist)
{
- Vector rr = mapLenToRef(Vector(dd,0), sys, dist);
- return rr[0];
+ Vector rr = mapLenToRef(Vector(0,dd), sys, dist);
+ return rr[1];
}
+#ifdef OLDWCS
Vector FitsImage::mapLenToRef(const Vector& vv, Coord::CoordSystem sys,
Coord::DistFormat dist)
{
@@ -292,63 +292,43 @@ Vector FitsImage::mapLenToRef(const Vector& vv, Coord::CoordSystem sys,
return Vector();
}
#else
-double FitsImage::mapLenToRef(double dd, Coord::CoordSystem sys,
+Vector FitsImage::mapLenToRef(const Vector& vv, Coord::CoordSystem sys,
Coord::DistFormat dist)
{
+ // this is correct
+ // we are looking for a length, so in image coords
switch (sys) {
case Coord::IMAGE:
- return dd*imageToRef[1].length();
+ return vv;
case Coord::PHYSICAL:
- return dd*physicalToRef[1].length();
+ return vv*physicalToImage;
case Coord::AMPLIFIER:
- return dd*(amplifierToPhysical * physicalToRef)[1].length();
+ return vv*amplifierToPhysical*physicalToImage;
case Coord::DETECTOR:
- return dd*(detectorToPhysical * physicalToRef)[1].length();
+ return vv*detectorToPhysical*physicalToImage;
default:
{
if (!hasWCS(sys) || !astInv_)
return 0;
-
- astClearStatus; // just to make sure
- setWCSSkyFrame(sys, Coord::FK5);
- double rdd = dd;
+ Vector svv = vv;
if (hasWCSCel(sys)) {
- rdd = dd;
switch (dist) {
case Coord::DEGREE:
break;
case Coord::ARCMIN:
- rdd /= 60.;
+ svv /= 60.;
break;
case Coord::ARCSEC:
- rdd /= 60.*60.;
+ svv /= 60.*60.;
break;
}
- rdd = degToRad(rdd); // no zeroTWOPI since this is a length
}
-
- Vector cc = center();
- Vector wcc = wcsTran(cc,1);
- Vector wpp = wcc+Vector(0,rdd);
- Vector pp = wcsTran(wpp,0);
- astInvert(ast_);
- double rr = wcsDistance(cc, pp);
- astInvert(ast_);
-
- return rr;
+ return svv/getWCSSize(sys);
}
}
- return 0;
-}
-
-Vector FitsImage::mapLenToRef(const Vector& vv, Coord::CoordSystem sys,
- Coord::DistFormat dist)
-{
- double rx = mapLenToRef(((Vector)vv)[0],sys,dist);
- double ry = mapLenToRef(((Vector)vv)[1],sys,dist);
- return Vector(rx,ry);
+ return Vector();
}
#endif