Skip to content
Snippets Groups Projects
Commit 35d330a1 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Corrected Trackball settings for X, Y and Z standard positions

parent a0a6d472
No related branches found
No related tags found
No related merge requests found
/* $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 "Gmsh.h"
#include "Const.h" #include "Const.h"
...@@ -374,6 +374,12 @@ void Context_T::buildRotmatrix(void) ...@@ -374,6 +374,12 @@ void Context_T::buildRotmatrix(void)
rot[3][1] = 0.0 ; rot[3][1] = 0.0 ;
rot[3][2] = 0.0 ; rot[3][2] = 0.0 ;
rot[3][3] = 1.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) ...@@ -385,7 +391,10 @@ void Context_T::addQuaternion (float p1x, float p1y, float p2x, float p2y)
add_quats(quat, quaternion, quaternion); 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;
} }
/* $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 "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -230,12 +230,18 @@ void KeyboardAccel(XEvent *event){ ...@@ -230,12 +230,18 @@ void KeyboardAccel(XEvent *event){
Init(); Draw(); Init(); Draw();
break; break;
case XK_x : case XK_X : 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(); set_r(0,0.); set_r(1,90.);set_r(2,0.); Init(); Draw();
break; break;
case XK_y : case XK_Y : 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(); set_r(0,-90.);set_r(1,0.); set_r(2,0.); Init(); Draw();
break; break;
case XK_z : case XK_Z : 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(); set_r(0,0.); set_r(1,0.); set_r(2,0.); Init(); Draw();
break; break;
case XK_a : case XK_a :
......
/* $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 "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -98,13 +98,13 @@ void OptionsCb (Widget w, XtPointer client_data, XtPointer call_data){ ...@@ -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_SCALEZ_LOCKED : CTX.slock[2] = !CTX.slock[2]; break;
case OPTIONS_XVIEW : case OPTIONS_XVIEW :
if(CTX.useTrackball) 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.); set_r(0,0.); set_r(1,90.);set_r(2,0.);
Init(); Draw(); Init(); Draw();
break; break;
case OPTIONS_YVIEW : case OPTIONS_YVIEW :
if(CTX.useTrackball) 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.); set_r(0,-90.);set_r(1,0.); set_r(2,0.);
Init(); Draw(); Init(); Draw();
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment