summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/ftnoir_tracker_pt.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-12-08 17:24:38 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-12-08 17:25:21 +0100
commit4442c953c05b0b1d240b088e0c6a3c4afdcdccf6 (patch)
treeea70f50ff4ab53231a74f8ec4e438c2e9e636d58 /tracker-pt/ftnoir_tracker_pt.cpp
parent4d882319ff8d77e2608c95a8aa0dc35fa8d00c6a (diff)
tracker/pt: use correct focal length formula
the formula works with ps3 eye zoom modes
Diffstat (limited to 'tracker-pt/ftnoir_tracker_pt.cpp')
-rw-r--r--tracker-pt/ftnoir_tracker_pt.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp
index 40293f56..9b78a16a 100644
--- a/tracker-pt/ftnoir_tracker_pt.cpp
+++ b/tracker-pt/ftnoir_tracker_pt.cpp
@@ -57,20 +57,19 @@ bool Tracker_PT::get_focal_length(f& ret)
using std::tan;
using std::atan;
using std::sqrt;
-#if 1
+
const double w = info.res_x, h = info.res_y;
+#if 0
const double diag = sqrt(w/h*w/h + h/w*h/w);
const double diag_fov = static_cast<int>(s.fov) * M_PI / 180.;
const double fov = 2.*atan(tan(diag_fov/2.)/diag);
ret = .5 / tan(.5 * fov);
#else
- // the formula looks correct but doesn't work right regardless
-
const double diag_fov = s.fov * M_PI/180;
const double aspect = w / sqrt(w*w + h*h);
const double fov = 2*atan(tan(diag_fov*.5) * aspect);
ret = .5 / tan(fov * .5);
- static bool once = false; if (!once) { once = true; qDebug() << "f" << ret << "fov" << (fov * 180/M_PI); }
+ //static bool once = false; if (!once) { once = true; qDebug() << "f" << ret << "fov" << (fov * 180/M_PI); }
#endif
return true;
}