diff --git a/openglcanvas.cpp b/openglcanvas.cpp
index 27a64627533860042295c9109bf476dc4fdbb5ac..d752f2533393638e446748880bdd66a8695dcf22 100644
--- a/openglcanvas.cpp
+++ b/openglcanvas.cpp
@@ -27,6 +27,7 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
{
setFormat(QGL::DoubleBuffer | QGL::DepthBuffer);
fov = 60.f;
+ fov_max = 60.f; // TODO: I only use floats here because Leo did... check
scale = 1.0f;
center_lambda = 0.f;
center_phi = 0.f;
@@ -37,6 +38,8 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
time_timer.setInterval(0);
connect(&time_timer, SIGNAL(timeout()), this, SLOT(slotTimer()));
time_start = time_time.time();
+
+ fprintf(stderr,"scale=%f\nfov_max=%f\n",scale,fov_max);
}
void OpenGLCanvas::slotTimer(void) {
@@ -45,23 +48,42 @@ void OpenGLCanvas::slotTimer(void) {
void OpenGLCanvas::change_fov(double f){
- if (fov!=f && f>=1.f && f<=360.f) fov = f;
- if (fov<60.f) scale = 1.f;
- else if (fov>295.f) scale = 0.02f;
+ if (fov!=f && f>=1.f && f<=360.f)
+ fov=f;
+ 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 == "Square Root") scale = sqrt((300.f-fov)/240.f);
- else if (fov_scale_relation == "Linear") scale = (300.f-fov)/240.f;
- else if (fov_scale_relation == "Square Power") scale = powf((300.f-fov)/240.f,2);
- else if (fov_scale_relation == "Cubic Power") scale = powf((300.f-fov)/240.f,3);
- else if (fov_scale_relation == "Logarithm") scale = log(exp(1.f) + (1.f-exp(1.f))*(fov-60.f)/240.f);
+ if (fov_scale_relation == "Naive")
+ scale=fov_max/fov;
+ else if (fov_scale_relation == "Square Root")
+ scale=sqrt((360.f-fov_max-fov)/(360.-2*fov_max));
+ else if (fov_scale_relation == "Linear")
+ scale=(360.f-fov_max-fov)/(360.-2*fov_max);
+ else if (fov_scale_relation == "Square Power")
+ scale=powf((360.f-fov_max-fov)/(360.-2*fov_max),2);
+ else if (fov_scale_relation == "Cubic Power")
+ scale=powf((360.f-fov_max-fov)/(360.-2*fov_max),3);
+ else if (fov_scale_relation == "Logarithm")
+ scale=log(exp(1.f)+(1.f-exp(1.f))*(fov-fov_max)/(360.-2*fov_max));
}
// scale = 0.3f;
+ fprintf(stderr,"scale=%f\nfov_max=%f\n",scale,fov_max);
+
updateGL();
}
+void OpenGLCanvas::change_fov_max(double new_fov_max){
+ fov_max=new_fov_max;
+ // TODO: change also the scale
+ fprintf(stderr,"scale=%f\nfov_max=%f\n",scale,fov_max);
+ updateGL();
+}
+
//void OpenGLCanvas::change_scale(double s){
// if (scale!=s && s>=0.0 && s<=1.0) scale = s;
@@ -93,12 +115,20 @@ void OpenGLCanvas::change_fov_scale_relation(QString name){
if (fov<60.f) scale = 1.f;
else if (fov>295.f) scale = 0.01f;
else{
- if (fov_scale_relation == "Square Root") scale = sqrt((300.f-fov)/240.f);
- else if (fov_scale_relation == "Linear") scale = (300.f-fov)/240.f;
- else if (fov_scale_relation == "Square Power") scale = powf((300.f-fov)/240.f,2);
- else if (fov_scale_relation == "Cubic Power") scale = powf((300.f-fov)/240.f,3);
- else if (fov_scale_relation == "Logarithm") scale = log(exp(1.f) + (1.f-exp(1.f))*(fov-60.f)/240.f);
+ if (fov_scale_relation == "Naive")
+ scale=fov_max/fov;
+ else if (fov_scale_relation == "Square Root")
+ scale=sqrt((360.f-fov_max-fov)/(360.-2*fov_max));
+ else if (fov_scale_relation == "Linear")
+ scale=(360.f-fov_max-fov)/(360.-2*fov_max);
+ else if (fov_scale_relation == "Square Power")
+ scale=powf((360.f-fov_max-fov)/(360.-2*fov_max),2);
+ else if (fov_scale_relation == "Cubic Power")
+ scale=powf((360.f-fov_max-fov)/(360.-2*fov_max),3);
+ else if (fov_scale_relation == "Logarithm")
+ scale=log(exp(1.f)+(1.f-exp(1.f))*(fov-fov_max)/(360.-2*fov_max));
}
+ fprintf(stderr,"scale=%f\nfov_max=%f\n",scale,fov_max);
updateGL();
}
diff --git a/openglcanvas.h b/openglcanvas.h
index 88dced1c7929508ed8db2306af347a1745324ffa..6ba05070ce925493836e3032a0ce023e31f141c3 100644
--- a/openglcanvas.h
+++ b/openglcanvas.h
@@ -61,6 +61,7 @@ signals:
public slots:
void change_fov(double f);
+ void change_fov_max(double new_fov_max);
// void change_scale(double s);
void change_center_lambda(double lambda);
void change_center_phi(double phi);
@@ -71,6 +72,7 @@ public slots:
private:
double fov;
+ double fov_max; // the \phi_{max} on the technote
double scale;
double center_lambda;
double center_phi;
diff --git a/panowindow1.ui b/panowindow1.ui
index df1f5d37dcf4a9a0244a08a0bf3f4173f704b0c3..7a9cb24644d1fb03a001bd659e0c4aad2edd22d7 100644
--- a/panowindow1.ui
+++ b/panowindow1.ui
@@ -37,6 +37,11 @@
Square Root
+ -
+
+ Naive
+
+
-
Linear