diff --git a/openglcanvas.cpp b/openglcanvas.cpp index 361dd04c59d6c76548313c5d9bae2a3d1506b045..8c2db0a0481737b8ed9c122e0cb189f4f05bea60 100644 --- a/openglcanvas.cpp +++ b/openglcanvas.cpp @@ -69,16 +69,38 @@ void OpenGLCanvas::change_fov(double f){ // scale = 0.3f; - fprintf(stderr,"scale=%f\nfov_max=%f\n",scale,fov_max); + fprintf(stderr,"change fov=%f, fov_max=%f\n",fov,fov_max); + emit fov_changed((int)fov); 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); +void OpenGLCanvas::change_fov(int new_fov){ + change_fov((double)new_fov); +} + +void OpenGLCanvas::change_fov_max(int new_fov_max){ + fov_max=(double)new_fov_max; + 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=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,"change fov_max=%f, new scale=%f\n",fov_max,scale); updateGL(); } @@ -126,7 +148,7 @@ void OpenGLCanvas::change_fov_scale_relation(QString name){ 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); + fprintf(stderr,"changed scale relation, scale=%f, fov_max=%f\n",scale,fov_max); updateGL(); } @@ -646,8 +668,7 @@ void OpenGLCanvas::mouseMoveEvent(QMouseEvent *event){ void OpenGLCanvas::wheelEvent(QWheelEvent *event){ if(event->orientation()==Qt::Vertical){ - fov+=((double)event->delta())/60; - updateGL(); + change_fov(fov+((double)event->delta())/60); } } diff --git a/openglcanvas.h b/openglcanvas.h index f0e0617ed76fd4581dd834edaffbb51ab072c2ed..7837b8dd707f9e42fb8cf5045e1ebe420ce3e13a 100644 --- a/openglcanvas.h +++ b/openglcanvas.h @@ -61,10 +61,12 @@ protected: signals: void fps(QString newFPS); + void fov_changed(int new_fov); public slots: void change_fov(double f); - void change_fov_max(double new_fov_max); + void change_fov(int new_fov); + void change_fov_max(int new_fov_max); // void change_scale(double s); void change_center_lambda(double lambda); void change_center_phi(double phi); diff --git a/panowindow1.ui b/panowindow1.ui index a1f566e2ab7d0d59f8347412fc1fba144d611f64..66420f141abbd552e959633381cc8b63a2cff739 100644 --- a/panowindow1.ui +++ b/panowindow1.ui @@ -14,8 +14,95 @@ PanoWindow1 - - + + + + + 61 + 25 + + + + -1.570000000000000 + + + 1.570000000000000 + + + 0.010000000000000 + + + + + + + Input Image + + + + + + + 1 + + + 359 + + + 60 + + + Qt::Vertical + + + + + + + Visualization + + + + + + + + Perspective + + + + + 3D Sphere + + + + + Equi-Rectangular + + + + + + + + 10 + + + 180 + + + 60 + + + Qt::Vertical + + + QSlider::NoTicks + + + 10 + + @@ -24,6 +111,30 @@ + + + + Close + + + + + + + FOV max + + + + + + + FOV + + + + + + @@ -64,63 +175,14 @@ - - - - Visualization - - - - - - - - Perspective - - - - - 3D Sphere - - - - - Equi-Rectangular - - - - - - - Field of View - - - - - - - 1.000000000000000 - - - 360.000000000000000 - - - 2.000000000000000 - - - 60.000000000000000 - - - - Center Point - + @@ -139,52 +201,6 @@ - - - - - 61 - 25 - - - - -1.570000000000000 - - - 1.570000000000000 - - - 0.010000000000000 - - - - - - - Input Image - - - - - - - Qt::Vertical - - - - 20 - 145 - - - - - - - - Close - - - @@ -195,6 +211,7 @@
openglcanvas.h
1 + fov_changed(int) change_fov(double) change_scale(double) change_center_lambda(double) @@ -202,6 +219,8 @@ change_fov_scale_relation(QString) change_visualization(QString) change_input_image() + change_fov_max(int) + change_fov(int) @@ -223,22 +242,6 @@ - - doubleSpinBox - valueChanged(double) - GLCanvas - change_fov(double) - - - 592 - 174 - - - 507 - 252 - - - doubleSpinBox_3 valueChanged(double) @@ -319,5 +322,53 @@ + + changefovmax + sliderMoved(int) + GLCanvas + change_fov_max(int) + + + 512 + 363 + + + 250 + 249 + + + + + changefov + sliderMoved(int) + GLCanvas + change_fov(int) + + + 607 + 352 + + + 250 + 249 + + + + + GLCanvas + fov_changed(int) + changefov + setValue(int) + + + 250 + 249 + + + 607 + 324 + + +