Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Luis Penaranda
panoramic
Commits
053e329f
Commit
053e329f
authored
Jan 22, 2013
by
Luis Peñaranda
Browse files
added variable fov_max
parent
c8f5aa48
Changes
3
Hide whitespace changes
Inline
Side-by-side
openglcanvas.cpp
View file @
053e329f
...
...
@@ -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.0
f
;
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
\n
fov_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.02
f
;
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.02
f
;
// 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
\n
fov_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
\n
fov_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.01
f
;
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
\n
fov_max=%f
\n
"
,
scale
,
fov_max
);
updateGL
();
}
...
...
openglcanvas.h
View file @
053e329f
...
...
@@ -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
;
...
...
panowindow1.ui
View file @
053e329f
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment