summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-01-25 22:11:07 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-01-25 22:11:07 (GMT)
commit9b9d4cdc460a4fab20ce36cc53a79c3e42a6fdc5 (patch)
tree0faac6952671461652300224ce6ac51977ec8de2 /tksao
parent36744276e0ab64178e6dbdcdff27507dba4c2e43 (diff)
downloadblt-9b9d4cdc460a4fab20ce36cc53a79c3e42a6fdc5.zip
blt-9b9d4cdc460a4fab20ce36cc53a79c3e42a6fdc5.tar.gz
blt-9b9d4cdc460a4fab20ce36cc53a79c3e42a6fdc5.tar.bz2
issue with 3d az_||el_ at 90deg
Diffstat (limited to 'tksao')
-rw-r--r--tksao/frame/fr3dmap.C35
-rw-r--r--tksao/frame/frmap.C3
2 files changed, 23 insertions, 15 deletions
diff --git a/tksao/frame/fr3dmap.C b/tksao/frame/fr3dmap.C
index 53fc2c8..5e6a8c6 100644
--- a/tksao/frame/fr3dmap.C
+++ b/tksao/frame/fr3dmap.C
@@ -66,16 +66,6 @@ Vector3d Frame3dBase::mapToRef3d(const Vector& vv, Coord::InternalSystem sys,
break;
}
- // note: sl is in REF=DATA coordinates
- Vector3d xx = Vector3d(1,0,sl)*refToWidget3d;
- Vector3d yy = Vector3d(0,1,sl)*refToWidget3d;
- Vector3d oo = Vector3d(0,0,sl)*refToWidget3d;
-
- Vector3d ii=xx-oo;
- Vector3d jj=yy-oo;
- Vector3d nn = cross(jj,ii).normalize();
- double dd = -(nn*xx);
-
Vector ww;
switch (sys) {
case Coord::WIDGET:
@@ -94,11 +84,28 @@ Vector3d Frame3dBase::mapToRef3d(const Vector& vv, Coord::InternalSystem sys,
ww = vv*magnifierToWidget;
break;
default:
- // na
- break;
+ // should not happen
+ return Vector3d();
}
+ // note: sl is in REF=DATA coordinates
+ Vector3d xx = Vector3d(1,0,sl)*refToWidget3d;
+ Vector3d yy = Vector3d(0,1,sl)*refToWidget3d;
+ Vector3d oo = Vector3d(0,0,sl)*refToWidget3d;
+
+ Vector3d ii=xx-oo;
+ Vector3d jj=yy-oo;
+ Vector3d nn = cross(jj,ii).normalize();
+ double dd = -(nn*xx);
+
double zz = (-nn[0]*ww[0]-nn[1]*ww[1]-dd) / nn[2];
- return Vector3d(ww,zz)*widgetToRef3d;
-}
+ Vector3d rr = Vector3d(ww,zz)*widgetToRef3d;
+
+ // if othogonal, set to center
+ if (teq(az_,M_PI_2,.001) || teq(az_,3*M_PI_2,.001))
+ rr[0] = vp_[0];
+ if (teq(el_,M_PI_2,.001) || teq(el_,3*M_PI_2,.001))
+ rr[1] = vp_[1];
+ return rr;
+}
diff --git a/tksao/frame/frmap.C b/tksao/frame/frmap.C
index a305914..93f9b96 100644
--- a/tksao/frame/frmap.C
+++ b/tksao/frame/frmap.C
@@ -133,7 +133,8 @@ Vector FrameBase::mapFromRef(const Vector& vv, Coord::InternalSystem sys)
return vv * refToPanner;
case Coord::MAGNIFIER:
return vv * refToMagnifier;
- default:
+ case Coord::PS:
+ // should not happen
return Vector();
}
}