Skip to content
Snippets Groups Projects
Commit 7fd923ed authored by Gilles Marckmann's avatar Gilles Marckmann
Browse files

correction in the use of option camera instead of trackballHyperbolicSheet

parent 39a86f7e
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
* float->double + optional use of hyperbolic sheet for z-rotation) * float->double + optional use of hyperbolic sheet for z-rotation)
*/ */
#include <math.h> #include <math.h>
#include "Gmsh.h"
#include "Trackball.h" #include "Trackball.h"
#include "Context.h" #include "Context.h"
#include <iostream> #include <iostream>
...@@ -195,32 +194,20 @@ trackball(double q[4], double p1x, double p1y, double p2x, double p2y) ...@@ -195,32 +194,20 @@ trackball(double q[4], double p1x, double p1y, double p2x, double p2y)
vsub(p1,p2,d); vsub(p1,p2,d);
t = vlength(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... * Avoid problems with out-of-control values...
*/ */
if (t > 1.0) t = 1.0; if (t > 1.0) t = 1.0;
if (t < -1.0) t = -1.0; if (t < -1.0) t = -1.0;
phi = 2.0 * asin(t); 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. * Given an axis and angle, compute quaternion.
*/ */
void void axis_to_quat(double a[3], double phi, double q[4])
axis_to_quat(double a[3], double phi, double q[4])
{ {
vnormal(a); vnormal(a);
vcopy(a,q); vcopy(a,q);
...@@ -243,7 +230,8 @@ tb_project_to_sphere(double r, double x, double y) ...@@ -243,7 +230,8 @@ tb_project_to_sphere(double r, double x, double y)
if (d < r * 0.70710678118654752440) { if (d < r * 0.70710678118654752440) {
// Inside sphere // Inside sphere
z = sqrt(r*r - d*d); z = sqrt(r*r - d*d);
} else { }
else {
// On hyperbola // On hyperbola
t = r / 1.41421356237309504880; t = r / 1.41421356237309504880;
z = t*t / d; z = t*t / d;
......
...@@ -420,7 +420,7 @@ int main(int argc, char **argv) ...@@ -420,7 +420,7 @@ int main(int argc, char **argv)
GmshSetOption("General", "Camera", 1.); GmshSetOption("General", "Camera", 1.);
GmshSetOption("General", "Orthographic", 0.); GmshSetOption("General", "Orthographic", 0.);
GmshSetOption("General", "TrackballHyperbolicSheet", 0.); GmshSetOption("General", "TrackballHyperbolicSheet", 0.);
CTX::instance()->trackballHyperbolicSheet=0;
if (strstr(argv[1],"-s") != NULL){ if (strstr(argv[1],"-s") != NULL){
camera.stereoEnable = true; camera.stereoEnable = true;
cout<<"mode STEREO"<<endl; cout<<"mode STEREO"<<endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment