diff --git a/Common/Context.cpp b/Common/Context.cpp index b86349c0da62acd113e717ca8f6b9d90b7cc2787..2b65dc134a7386008061a41937a8ea4143ddaae7 100644 --- a/Common/Context.cpp +++ b/Common/Context.cpp @@ -1,4 +1,4 @@ -/* $Id: Context.cpp,v 1.23 2000-12-20 15:28:42 geuzaine Exp $ */ +/* $Id: Context.cpp,v 1.24 2000-12-22 17:01:37 geuzaine Exp $ */ #include "Gmsh.h" #include "Const.h" @@ -374,6 +374,12 @@ void Context_T::buildRotmatrix(void) rot[3][1] = 0.0 ; rot[3][2] = 0.0 ; rot[3][3] = 1.0 ; + /* + printf("x=%g y=%g z=%g\n", r[0], r[1], r[2]); + printf("[%g %g %g]\n", rot[0][0], rot[0][1], rot[0][2]); + printf("[%g %g %g]\n", rot[1][0], rot[1][1], rot[1][2]); + printf("[%g %g %g]\n", rot[2][0], rot[2][1], rot[2][2]); + */ } } @@ -385,7 +391,10 @@ void Context_T::addQuaternion (float p1x, float p1y, float p2x, float p2y) add_quats(quat, quaternion, quaternion); } -void Context_T::setQuaternion (float p1x, float p1y, float p2x, float p2y) +void Context_T::setQuaternion (float q0, float q1, float q2, float q3) { - trackball(quaternion,p1x,p1y,p2x,p2y); + quaternion[0] = q0; + quaternion[1] = q1; + quaternion[2] = q2; + quaternion[3] = q3; } diff --git a/Unix/CbInput.cpp b/Unix/CbInput.cpp index f323beb916e08269de7da4794274d956ec694932..15463188adaef7765fe4b43d9fcac2cbdf74cb28 100644 --- a/Unix/CbInput.cpp +++ b/Unix/CbInput.cpp @@ -1,4 +1,4 @@ -/* $Id: CbInput.cpp,v 1.12 2000-12-20 12:17:13 geuzaine Exp $ */ +/* $Id: CbInput.cpp,v 1.13 2000-12-22 17:01:39 geuzaine Exp $ */ #include "Gmsh.h" #include "GmshUI.h" @@ -230,12 +230,18 @@ void KeyboardAccel(XEvent *event){ Init(); Draw(); break; case XK_x : case XK_X : + if(CTX.useTrackball) + CTX.setQuaternion(0.,-1./sqrt(2.),0.,1./sqrt(2.)); set_r(0,0.); set_r(1,90.);set_r(2,0.); Init(); Draw(); break; case XK_y : case XK_Y : + if(CTX.useTrackball) + CTX.setQuaternion(1./sqrt(2.),0.,1./sqrt(2.),0.); set_r(0,-90.);set_r(1,0.); set_r(2,0.); Init(); Draw(); break; case XK_z : case XK_Z : + if(CTX.useTrackball) + CTX.setQuaternion(0.,0.,0.,0.); set_r(0,0.); set_r(1,0.); set_r(2,0.); Init(); Draw(); break; case XK_a : diff --git a/Unix/CbOptions.cpp b/Unix/CbOptions.cpp index ff03847e04a3457aef24f1f0220ba7d00d3e11e7..d97dfff162085b07c32fa4e3c9e332d83a504e3c 100644 --- a/Unix/CbOptions.cpp +++ b/Unix/CbOptions.cpp @@ -1,4 +1,4 @@ -/* $Id: CbOptions.cpp,v 1.15 2000-12-21 08:02:06 geuzaine Exp $ */ +/* $Id: CbOptions.cpp,v 1.16 2000-12-22 17:01:39 geuzaine Exp $ */ #include "Gmsh.h" #include "GmshUI.h" @@ -98,13 +98,13 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){ case OPTIONS_SCALEZ_LOCKED : CTX.slock[2] = !CTX.slock[2]; break; case OPTIONS_XVIEW : if(CTX.useTrackball) - CTX.setQuaternion(0.,0.,1.,0.); + CTX.setQuaternion(0.,-1./sqrt(2.),0.,1./sqrt(2.)); set_r(0,0.); set_r(1,90.);set_r(2,0.); Init(); Draw(); break; case OPTIONS_YVIEW : if(CTX.useTrackball) - CTX.setQuaternion(0.,-1.,0.,0.); + CTX.setQuaternion(1./sqrt(2.),0.,1./sqrt(2.),0.); set_r(0,-90.);set_r(1,0.); set_r(2,0.); Init(); Draw(); break;