Commit 053e329f authored by Luis Peñaranda's avatar Luis Peñaranda
Browse files

added variable fov_max

parent c8f5aa48
Loading
Loading
Loading
Loading
+44 −14
Original line number Diff line number Diff line
@@ -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();

}
+2 −0
Original line number Diff line number Diff line
@@ -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;
+5 −0
Original line number Diff line number Diff line
@@ -37,6 +37,11 @@
       <string>Square Root</string>
      </property>
     </item>
     <item>
      <property name="text">
       <string>Naive</string>
      </property>
     </item>
     <item>
      <property name="text">
       <string>Linear</string>