From 7fd923ed96067dc9c28498ac3bbe1a6bb3df2db3 Mon Sep 17 00:00:00 2001
From: Gilles Marckmann <gilles.marckmann@ec-nantes.fr>
Date: Thu, 4 Nov 2010 09:28:54 +0000
Subject: [PATCH] correction in the use of option camera instead of
 trackballHyperbolicSheet

---
 Graphics/Trackball.cpp       | 20 ++++----------------
 utils/api_demos/mainGlut.cpp |  2 +-
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/Graphics/Trackball.cpp b/Graphics/Trackball.cpp
index f32e5b0c65..f24e76243b 100644
--- a/Graphics/Trackball.cpp
+++ b/Graphics/Trackball.cpp
@@ -54,7 +54,6 @@
  * float->double + optional use of hyperbolic sheet for z-rotation)
  */
 #include <math.h>
-#include "Gmsh.h"
 #include "Trackball.h"
 #include "Context.h"
 #include <iostream>
@@ -195,32 +194,20 @@ trackball(double q[4], double p1x, double p1y, double p2x, double p2y)
   vsub(p1,p2,d);
   t = vlength(d);
  
-  double _camera;
-  GmshGetOption("General", "Camera",_camera );
-  if (_camera )     t = vlength(d) / (2.0*TRACKBALLSIZE);
-    t = vlength(d) / (2.0*TRACKBALLSIZE);
-  
   /*
    * Avoid problems with out-of-control values...
    */
   if (t > 1.0) t = 1.0;
   if (t < -1.0) t = -1.0;
   phi = 2.0 * asin(t);
-  /*
-   * Avoid problems with out-of-control values...
-   */
-  if (t > 1.0) t = 1.0;
-    if (t < -1.0) t = -1.0;
-    phi = 2.0 * asin(t);
 
-    axis_to_quat(a,phi,q);
+  axis_to_quat(a,phi,q);
 }
 
 /*
  *  Given an axis and angle, compute quaternion.
  */
-void
-axis_to_quat(double a[3], double phi, double q[4])
+void axis_to_quat(double a[3], double phi, double q[4])
 {
     vnormal(a);
     vcopy(a,q);
@@ -243,7 +230,8 @@ tb_project_to_sphere(double r, double x, double y)
     if (d < r * 0.70710678118654752440) {    
       // Inside sphere 
       z = sqrt(r*r - d*d);
-    } else {           
+    }
+    else {     
       // On hyperbola 
       t = r / 1.41421356237309504880;
       z = t*t / d;
diff --git a/utils/api_demos/mainGlut.cpp b/utils/api_demos/mainGlut.cpp
index e16a0dbfaf..1792801bda 100644
--- a/utils/api_demos/mainGlut.cpp
+++ b/utils/api_demos/mainGlut.cpp
@@ -420,7 +420,7 @@ int main(int argc, char **argv)
   GmshSetOption("General", "Camera", 1.);
   GmshSetOption("General", "Orthographic", 0.);
   GmshSetOption("General", "TrackballHyperbolicSheet", 0.);
-
+  CTX::instance()->trackballHyperbolicSheet=0;
   if (strstr(argv[1],"-s") != NULL){
    camera.stereoEnable = true;
    cout<<"mode STEREO"<<endl;
-- 
GitLab