From df0ae4687ccfaa89222b0925e276e5bd75abe3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Thu, 5 Sep 2013 18:42:20 -0300 Subject: [PATCH] added hidden parameter shrink_for_all=false --- openglcanvas.cpp | 115 ++++++++++++++++++++++++++--------------------- openglcanvas.h | 1 + 2 files changed, 65 insertions(+), 51 deletions(-) diff --git a/openglcanvas.cpp b/openglcanvas.cpp index 631739e..29745b2 100644 --- a/openglcanvas.cpp +++ b/openglcanvas.cpp @@ -40,6 +40,7 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) : fov_scale_relation = "Naive"; visualization = "Moebius"; auto_fov_max=false; + shrink_for_all=false; zblambda=.1f; // Zorin-Barr transformation lambda zbR=1.f; // Zorin-Barr transformation R @@ -57,23 +58,27 @@ void OpenGLCanvas::change_fov(double f){ if (fov!=f && f>=1.f && f<=360.f) fov=f; - if (fov<=fov_max) + if (shrink_for_all || visualization=="Moebius" || visualization=="3D Sphere"){ + if (fov<=fov_max) + scale=1.f; + //else if (fov>295.f) + // scale = 0.02f; // TODO: check this value wrt fov_max + else { + if (fov_scale_relation == "Naive") + scale=fov_max/fov; + else if (fov_scale_relation == "Square Root") + scale=sqrtf((360.f-fov_max-fov)/(360.-2*fov_max)); + else if (fov_scale_relation == "Linear") + scale=(360.f-fov_max-fov)/(360.f-2.f*fov_max); + else if (fov_scale_relation == "Square Power") + scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),2.f); + else if (fov_scale_relation == "Cubic Power") + scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),3.f); + else if (fov_scale_relation == "Logarithm") + scale=logf(expf(1.f)+(1.f-expf(1.f))*(fov-fov_max)/(360.f-2.f*fov_max)); + } + }else{ scale=1.f; - //else if (fov>295.f) - // scale = 0.02f; // TODO: check this value wrt fov_max - else { - if (fov_scale_relation == "Naive") - scale=fov_max/fov; - else if (fov_scale_relation == "Square Root") - scale=sqrtf((360.f-fov_max-fov)/(360.-2*fov_max)); - else if (fov_scale_relation == "Linear") - scale=(360.f-fov_max-fov)/(360.f-2.f*fov_max); - else if (fov_scale_relation == "Square Power") - scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),2.f); - else if (fov_scale_relation == "Cubic Power") - scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),3.f); - else if (fov_scale_relation == "Logarithm") - scale=logf(expf(1.f)+(1.f-expf(1.f))*(fov-fov_max)/(360.f-2.f*fov_max)); } // scale = 0.3f; @@ -101,23 +106,27 @@ void OpenGLCanvas::change_fov(int new_fov){ void OpenGLCanvas::change_fov_max(int new_fov_max){ if(new_fov_max<=360.f&&new_fov_max>=1) fov_max=(double)new_fov_max; - if (fov<=fov_max) + if (shrink_for_all || visualization=="Moebius" || visualization=="3D Sphere"){ + if (fov<=fov_max) + scale=1.f; + //else if (fov>295.f) + // scale = 0.02f; // TODO: check this value wrt fov_max + else { + if (fov_scale_relation == "Naive") + scale=fov_max/fov; + else if (fov_scale_relation == "Square Root") + scale=sqrtf((360.f-fov_max-fov)/(360.f-2.f*fov_max)); + else if (fov_scale_relation == "Linear") + scale=(360.f-fov_max-fov)/(360.f-2.f*fov_max); + else if (fov_scale_relation == "Square Power") + scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),2.f); + else if (fov_scale_relation == "Cubic Power") + scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),3.f); + else if (fov_scale_relation == "Logarithm") + scale=logf(expf(1.f)+(1.f-expf(1.f))*(fov-fov_max)/(360.f-2.f*fov_max)); + } + }else{ scale=1.f; - //else if (fov>295.f) - // scale = 0.02f; // TODO: check this value wrt fov_max - else { - if (fov_scale_relation == "Naive") - scale=fov_max/fov; - else if (fov_scale_relation == "Square Root") - scale=sqrtf((360.f-fov_max-fov)/(360.f-2.f*fov_max)); - else if (fov_scale_relation == "Linear") - scale=(360.f-fov_max-fov)/(360.f-2.f*fov_max); - else if (fov_scale_relation == "Square Power") - scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),2.f); - else if (fov_scale_relation == "Cubic Power") - scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),3.f); - else if (fov_scale_relation == "Logarithm") - scale=logf(expf(1.f)+(1.f-expf(1.f))*(fov-fov_max)/(360.f-2.f*fov_max)); } fprintf(stderr,"change fov_max, fov=%f, fov_max=%f, new scale=%f\n",fov,fov_max,scale); emit max_fov_changed((int)fov_max); @@ -157,25 +166,29 @@ void OpenGLCanvas::re_center(){ void OpenGLCanvas::change_fov_scale_relation(QString name){ - fov_scale_relation = name; - if (fov295.f) scale = 0.01f; - else{ - if (fov_scale_relation == "Naive") - scale=fov_max/fov; - else if (fov_scale_relation == "Square Root") - scale=sqrtf((360.f-fov_max-fov)/(360.f-2.f*fov_max)); - else if (fov_scale_relation == "Linear") - scale=(360.f-fov_max-fov)/(360.f-2.f*fov_max); - else if (fov_scale_relation == "Square Power") - scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),2.f); - else if (fov_scale_relation == "Cubic Power") - scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),3.f); - else if (fov_scale_relation == "Logarithm") - scale=logf(expf(1.f)+(1.f-expf(1.f))*(fov-fov_max)/(360.f-2.f*fov_max)); - } - fprintf(stderr,"changed scale relation, scale=%f, fov_max=%f\n",scale,fov_max); - updateGL(); + fov_scale_relation = name; + if (shrink_for_all || visualization=="Moebius" || visualization=="3D Sphere"){ + if (fov295.f) scale = 0.01f; + else{ + if (fov_scale_relation == "Naive") + scale=fov_max/fov; + else if (fov_scale_relation == "Square Root") + scale=sqrtf((360.f-fov_max-fov)/(360.f-2.f*fov_max)); + else if (fov_scale_relation == "Linear") + scale=(360.f-fov_max-fov)/(360.f-2.f*fov_max); + else if (fov_scale_relation == "Square Power") + scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),2.f); + else if (fov_scale_relation == "Cubic Power") + scale=powf((360.f-fov_max-fov)/(360.f-2.f*fov_max),3.f); + else if (fov_scale_relation == "Logarithm") + scale=logf(expf(1.f)+(1.f-expf(1.f))*(fov-fov_max)/(360.f-2.f*fov_max)); + } + }else{ + scale=1.f; + } + fprintf(stderr,"changed scale relation, scale=%f, fov_max=%f\n",scale,fov_max); + updateGL(); } diff --git a/openglcanvas.h b/openglcanvas.h index 9bde734..7470e4e 100644 --- a/openglcanvas.h +++ b/openglcanvas.h @@ -71,6 +71,7 @@ private: QString fov_scale_relation; QString visualization; bool auto_fov_max; + bool shrink_for_all; float zblambda,zbR; // parameters of the Zorin-Barr transformation Chronos time_time; -- GitLab