Loading openglcanvas.cpp +40 −69 Original line number Diff line number Diff line Loading @@ -58,29 +58,7 @@ void OpenGLCanvas::change_fov(double f){ if (fov!=f && f>=1.f && f<=360.f) fov=f; 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; } compute_scale(); // scale = 0.3f; fprintf(stderr,"change fov, fov=%f, fov_max=%f, scale=%f\n",fov,fov_max,scale); Loading @@ -95,6 +73,12 @@ void OpenGLCanvas::automaxbutton(bool autovalue){ change_fov_max(compute_auto_fov_max(fov)); } void OpenGLCanvas::shrinkallbutton(bool shrinkvalue){ shrink_for_all=shrinkvalue; compute_scale(); updateGL(); } void OpenGLCanvas::change_fov(int new_fov){ if(new_fov<=360&&new_fov>=1){ change_fov((double)new_fov); Loading @@ -106,28 +90,7 @@ 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 (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; } compute_scale(); 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); updateGL(); Loading Loading @@ -167,26 +130,7 @@ void OpenGLCanvas::re_center(){ void OpenGLCanvas::change_fov_scale_relation(QString name){ fov_scale_relation = name; if (shrink_for_all || visualization=="Moebius" || visualization=="3D Sphere"){ if (fov<fov_max) scale = 1.f; //else if (fov>295.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; } compute_scale(); fprintf(stderr,"changed scale relation, scale=%f, fov_max=%f\n",scale,fov_max); updateGL(); Loading @@ -194,8 +138,7 @@ void OpenGLCanvas::change_fov_scale_relation(QString name){ void OpenGLCanvas::change_visualization(QString name){ visualization=name; if(!shrink_for_all && visualization!="Moebius" && visualization!="3D Sphere") scale=1.f; compute_scale(); updateGL(); } Loading Loading @@ -606,12 +549,12 @@ float OpenGLCanvas::calculate_extent(float fov_rads){ // Write now it's olny showing the entire panorama intead of // the corresponging FOV. } if (visualization=="Zorin-Barr"){ else if (visualization=="Zorin-Barr"){ // TODO: check whether this is correct u=x/(-z); v=y/(-z); } if (visualization=="Orthographic"){ else if (visualization=="Orthographic"){ if(z<0.f){ u=x; v=y; Loading Loading @@ -653,6 +596,34 @@ int OpenGLCanvas::compute_auto_fov_max(int new_fov){ return (90-new_fov/2); } // This function computes the scale, in function of the projection method, // the fov/scale ratio and the value of shrink_for_all. void OpenGLCanvas::compute_scale(){ 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; } } void OpenGLCanvas::resizeGL(int w, int h){ if(w>h) glViewport(0,(h-w)/2,w,w); Loading openglcanvas.h +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ protected: private: int compute_auto_fov_max(int); void compute_scale(); char *textFileRead(char *fn); void setShaders(); Loading @@ -48,6 +49,7 @@ signals: public slots: void automaxbutton(bool); void shrinkallbutton(bool); void change_fov(double f); void change_fov(int new_fov); void change_fov_max(int new_fov_max); Loading panowindow1.ui +35 −11 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ </property> </widget> </item> <item row="15" column="1" colspan="2"> <item row="18" column="1" colspan="2"> <widget class="QPushButton" name="reCenter"> <property name="text"> <string>Re-center</string> Loading @@ -40,7 +40,7 @@ </property> </widget> </item> <item row="0" column="0" rowspan="18"> <item row="0" column="0" rowspan="21"> <widget class="OpenGLCanvas" name="GLCanvas" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> Loading Loading @@ -96,7 +96,7 @@ </item> </widget> </item> <item row="14" column="1" alignment="Qt::AlignHCenter"> <item row="17" column="1" alignment="Qt::AlignHCenter"> <widget class="QSlider" name="changefovmax"> <property name="minimum"> <number>1</number> Loading @@ -118,14 +118,14 @@ </property> </widget> </item> <item row="16" column="1" colspan="2"> <item row="19" column="1" colspan="2"> <widget class="QPushButton" name="chooseFile"> <property name="text"> <string>Input Image</string> </property> </widget> </item> <item row="13" column="1" alignment="Qt::AlignHCenter"> <item row="16" column="1" alignment="Qt::AlignHCenter"> <widget class="QLCDNumber" name="fovmaxled"> <property name="frameShape"> <enum>QFrame::NoFrame</enum> Loading @@ -135,14 +135,14 @@ </property> </widget> </item> <item row="17" column="1" colspan="2"> <item row="20" column="1" colspan="2"> <widget class="QPushButton" name="pushButton"> <property name="text"> <string>Close</string> </property> </widget> </item> <item row="14" column="2" alignment="Qt::AlignHCenter"> <item row="17" column="2" alignment="Qt::AlignHCenter"> <widget class="QSlider" name="changefov"> <property name="minimum"> <number>1</number> Loading @@ -158,7 +158,7 @@ </property> </widget> </item> <item row="13" column="2" alignment="Qt::AlignHCenter"> <item row="16" column="2" alignment="Qt::AlignHCenter"> <widget class="QLCDNumber" name="fovled"> <property name="frameShape"> <enum>QFrame::NoFrame</enum> Loading @@ -168,7 +168,7 @@ </property> </widget> </item> <item row="12" column="2" alignment="Qt::AlignHCenter"> <item row="15" column="2" alignment="Qt::AlignHCenter"> <widget class="QLabel" name="label_6"> <property name="text"> <string>FOV</string> Loading Loading @@ -214,14 +214,14 @@ </item> </widget> </item> <item row="12" column="1"> <item row="15" column="1"> <widget class="QLabel" name="label_5"> <property name="text"> <string>FOV max</string> </property> </widget> </item> <item row="11" column="1" colspan="2"> <item row="14" column="1" colspan="2"> <widget class="QCheckBox" name="automax"> <property name="enabled"> <bool>true</bool> Loading @@ -237,6 +237,13 @@ </property> </widget> </item> <item row="13" column="1"> <widget class="QCheckBox" name="shrinkAll"> <property name="text"> <string>Shrink all</string> </property> </widget> </item> </layout> </widget> <layoutdefault spacing="6" margin="11"/> Loading @@ -260,6 +267,7 @@ <slot>change_fov(int)</slot> <slot>re_center()</slot> <slot>automaxbutton(bool)</slot> <slot>shrinkallbutton(bool)</slot> </slots> </customwidget> </customwidgets> Loading Loading @@ -489,5 +497,21 @@ </hint> </hints> </connection> <connection> <sender>shrinkAll</sender> <signal>toggled(bool)</signal> <receiver>GLCanvas</receiver> <slot>shrinkallbutton(bool)</slot> <hints> <hint type="sourcelabel"> <x>540</x> <y>185</y> </hint> <hint type="destinationlabel"> <x>247</x> <y>249</y> </hint> </hints> </connection> </connections> </ui> Loading
openglcanvas.cpp +40 −69 Original line number Diff line number Diff line Loading @@ -58,29 +58,7 @@ void OpenGLCanvas::change_fov(double f){ if (fov!=f && f>=1.f && f<=360.f) fov=f; 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; } compute_scale(); // scale = 0.3f; fprintf(stderr,"change fov, fov=%f, fov_max=%f, scale=%f\n",fov,fov_max,scale); Loading @@ -95,6 +73,12 @@ void OpenGLCanvas::automaxbutton(bool autovalue){ change_fov_max(compute_auto_fov_max(fov)); } void OpenGLCanvas::shrinkallbutton(bool shrinkvalue){ shrink_for_all=shrinkvalue; compute_scale(); updateGL(); } void OpenGLCanvas::change_fov(int new_fov){ if(new_fov<=360&&new_fov>=1){ change_fov((double)new_fov); Loading @@ -106,28 +90,7 @@ 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 (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; } compute_scale(); 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); updateGL(); Loading Loading @@ -167,26 +130,7 @@ void OpenGLCanvas::re_center(){ void OpenGLCanvas::change_fov_scale_relation(QString name){ fov_scale_relation = name; if (shrink_for_all || visualization=="Moebius" || visualization=="3D Sphere"){ if (fov<fov_max) scale = 1.f; //else if (fov>295.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; } compute_scale(); fprintf(stderr,"changed scale relation, scale=%f, fov_max=%f\n",scale,fov_max); updateGL(); Loading @@ -194,8 +138,7 @@ void OpenGLCanvas::change_fov_scale_relation(QString name){ void OpenGLCanvas::change_visualization(QString name){ visualization=name; if(!shrink_for_all && visualization!="Moebius" && visualization!="3D Sphere") scale=1.f; compute_scale(); updateGL(); } Loading Loading @@ -606,12 +549,12 @@ float OpenGLCanvas::calculate_extent(float fov_rads){ // Write now it's olny showing the entire panorama intead of // the corresponging FOV. } if (visualization=="Zorin-Barr"){ else if (visualization=="Zorin-Barr"){ // TODO: check whether this is correct u=x/(-z); v=y/(-z); } if (visualization=="Orthographic"){ else if (visualization=="Orthographic"){ if(z<0.f){ u=x; v=y; Loading Loading @@ -653,6 +596,34 @@ int OpenGLCanvas::compute_auto_fov_max(int new_fov){ return (90-new_fov/2); } // This function computes the scale, in function of the projection method, // the fov/scale ratio and the value of shrink_for_all. void OpenGLCanvas::compute_scale(){ 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; } } void OpenGLCanvas::resizeGL(int w, int h){ if(w>h) glViewport(0,(h-w)/2,w,w); Loading
openglcanvas.h +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ protected: private: int compute_auto_fov_max(int); void compute_scale(); char *textFileRead(char *fn); void setShaders(); Loading @@ -48,6 +49,7 @@ signals: public slots: void automaxbutton(bool); void shrinkallbutton(bool); void change_fov(double f); void change_fov(int new_fov); void change_fov_max(int new_fov_max); Loading
panowindow1.ui +35 −11 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ </property> </widget> </item> <item row="15" column="1" colspan="2"> <item row="18" column="1" colspan="2"> <widget class="QPushButton" name="reCenter"> <property name="text"> <string>Re-center</string> Loading @@ -40,7 +40,7 @@ </property> </widget> </item> <item row="0" column="0" rowspan="18"> <item row="0" column="0" rowspan="21"> <widget class="OpenGLCanvas" name="GLCanvas" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> Loading Loading @@ -96,7 +96,7 @@ </item> </widget> </item> <item row="14" column="1" alignment="Qt::AlignHCenter"> <item row="17" column="1" alignment="Qt::AlignHCenter"> <widget class="QSlider" name="changefovmax"> <property name="minimum"> <number>1</number> Loading @@ -118,14 +118,14 @@ </property> </widget> </item> <item row="16" column="1" colspan="2"> <item row="19" column="1" colspan="2"> <widget class="QPushButton" name="chooseFile"> <property name="text"> <string>Input Image</string> </property> </widget> </item> <item row="13" column="1" alignment="Qt::AlignHCenter"> <item row="16" column="1" alignment="Qt::AlignHCenter"> <widget class="QLCDNumber" name="fovmaxled"> <property name="frameShape"> <enum>QFrame::NoFrame</enum> Loading @@ -135,14 +135,14 @@ </property> </widget> </item> <item row="17" column="1" colspan="2"> <item row="20" column="1" colspan="2"> <widget class="QPushButton" name="pushButton"> <property name="text"> <string>Close</string> </property> </widget> </item> <item row="14" column="2" alignment="Qt::AlignHCenter"> <item row="17" column="2" alignment="Qt::AlignHCenter"> <widget class="QSlider" name="changefov"> <property name="minimum"> <number>1</number> Loading @@ -158,7 +158,7 @@ </property> </widget> </item> <item row="13" column="2" alignment="Qt::AlignHCenter"> <item row="16" column="2" alignment="Qt::AlignHCenter"> <widget class="QLCDNumber" name="fovled"> <property name="frameShape"> <enum>QFrame::NoFrame</enum> Loading @@ -168,7 +168,7 @@ </property> </widget> </item> <item row="12" column="2" alignment="Qt::AlignHCenter"> <item row="15" column="2" alignment="Qt::AlignHCenter"> <widget class="QLabel" name="label_6"> <property name="text"> <string>FOV</string> Loading Loading @@ -214,14 +214,14 @@ </item> </widget> </item> <item row="12" column="1"> <item row="15" column="1"> <widget class="QLabel" name="label_5"> <property name="text"> <string>FOV max</string> </property> </widget> </item> <item row="11" column="1" colspan="2"> <item row="14" column="1" colspan="2"> <widget class="QCheckBox" name="automax"> <property name="enabled"> <bool>true</bool> Loading @@ -237,6 +237,13 @@ </property> </widget> </item> <item row="13" column="1"> <widget class="QCheckBox" name="shrinkAll"> <property name="text"> <string>Shrink all</string> </property> </widget> </item> </layout> </widget> <layoutdefault spacing="6" margin="11"/> Loading @@ -260,6 +267,7 @@ <slot>change_fov(int)</slot> <slot>re_center()</slot> <slot>automaxbutton(bool)</slot> <slot>shrinkallbutton(bool)</slot> </slots> </customwidget> </customwidgets> Loading Loading @@ -489,5 +497,21 @@ </hint> </hints> </connection> <connection> <sender>shrinkAll</sender> <signal>toggled(bool)</signal> <receiver>GLCanvas</receiver> <slot>shrinkallbutton(bool)</slot> <hints> <hint type="sourcelabel"> <x>540</x> <y>185</y> </hint> <hint type="destinationlabel"> <x>247</x> <y>249</y> </hint> </hints> </connection> </connections> </ui>