summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-12-16 22:33:19 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-12-16 22:33:19 (GMT)
commit55e7493613e82d4079720241e2d411acbe085eea (patch)
treeebc21e2bbbb323532f3ff15fa1e13543d382f39a /tksao
parentb98f386054899a17c12336cb5888394c287172ee (diff)
downloadblt-55e7493613e82d4079720241e2d411acbe085eea.zip
blt-55e7493613e82d4079720241e2d411acbe085eea.tar.gz
blt-55e7493613e82d4079720241e2d411acbe085eea.tar.bz2
upgrade AST
Diffstat (limited to 'tksao')
-rw-r--r--tksao/frame/fitsimage.C78
1 files changed, 62 insertions, 16 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index cdb2bc6..b98d75f 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -3030,22 +3030,68 @@ Coord::Orientation FitsImage::getWCSOrientation(Coord::CoordSystem sys,
setWCSSkyFrame(sys, sky);
- Vector cc = center();
- Vector wcc = wcsTran(cc, 1);
- Vector wnorth = wcc + Vector(0,.001);
- Vector weast = wcc + Vector(.001,0);
- Vector north = wcsTran(wnorth,0);
- Vector east = wcsTran(weast,0);
- Vector nnorth = north.normalize();
- Vector neast = east.normalize();
-
- // take the cross product and see which way the 3rd axis is pointing
- double ww = neast[0]*nnorth[1] - neast[1]*nnorth[0];
-
- if (hasWCSCel(sys))
- return ww<=0 ? Coord::NORMAL : Coord::XX;
- else
- return ww>=0 ? Coord::NORMAL : Coord::XX;
+ double ang =0;
+ Coord::Orientation rr = Coord::NORMAL;
+ {
+ Vector in[3];
+ Vector out[3];
+ in[0] = center();
+ in[1] = center()+Vector(0,1);
+ in[2] = center()+Vector(1,0);
+ wcsTran(3, in, 1, out);
+ ang = wcsAngle(out[0],out[1],out[2]);
+
+ if (!(isnan(ang)||isinf(ang)||(ang == -DBL_MAX)||(ang == DBL_MAX))) {
+ if (hasWCSCel(sys))
+ rr = (ang>=0 ? Coord::NORMAL : Coord::XX);
+ else
+ rr = (ang<=0 ? Coord::NORMAL : Coord::XX);
+ }
+ cerr << rr << '=';
+ }
+ if (0) {
+ Coord::Orientation rr = Coord::NORMAL;
+ Vector in[3];
+ Vector out[3];
+ in[0] = center();
+ in[1] = center()+Vector(0,1);
+ in[2] = center()+Vector(1,0);
+ wcsTran(3, in, 1, out);
+ double ang = wcsAngle(out[1],out[0],out[2]);
+
+ // cerr << ang << ':' << radToDeg(ang) << ':';
+ if (!(isnan(ang)||isinf(ang)||(ang == -DBL_MAX)||(ang == DBL_MAX))) {
+ // backward
+ if (hasWCSCel(sys))
+ rr = (ang<=0 ? Coord::NORMAL : Coord::XX);
+ else
+ rr = (ang>=0 ? Coord::NORMAL : Coord::XX);
+ }
+ cerr << rr << '=';
+ }
+ if (1) {
+ Coord::Orientation rr = Coord::NORMAL;
+ Vector cc = center();
+ Vector wcc = wcsTran(cc, 1);
+ Vector wnorth = wcc + Vector(0,.001);
+ Vector weast = wcc + Vector(.001,0);
+ Vector north = wcsTran(wnorth,0);
+ Vector east = wcsTran(weast,0);
+ Vector nnorth = north.normalize();
+ Vector neast = east.normalize();
+ double ww = neast[0]*nnorth[1] - neast[1]*nnorth[0];
+
+ // cerr << w << ':';
+ if (hasWCSCel(sys))
+ rr = (ww<=0 ? Coord::NORMAL : Coord::XX);
+ else
+ rr = (ww>=0 ? Coord::NORMAL : Coord::XX);
+
+ cerr << rr;
+ }
+ cerr << endl;
+
+ return rr;
}
#endif