diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-03-07 01:11:21 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-03-07 01:11:21 +0100 |
commit | d241a49ec83d8a146ceddca44b1281c7e4c9da50 (patch) | |
tree | d31e95887ebabf85a06c7ccddcba773d30f96d97 /tracker-pt/point_tracker.cpp | |
parent | 1ab1d2c72315c03bf10c5c78bb6b3b674926039f (diff) | |
parent | 69005c7e0295b1b6f39e7d3f3d9d2911a31e246c (diff) |
Merge branch 'unstable' into trackhattrackhat-1.2p1
Diffstat (limited to 'tracker-pt/point_tracker.cpp')
-rw-r--r-- | tracker-pt/point_tracker.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tracker-pt/point_tracker.cpp b/tracker-pt/point_tracker.cpp index aa6feb5b..25240635 100644 --- a/tracker-pt/point_tracker.cpp +++ b/tracker-pt/point_tracker.cpp @@ -194,7 +194,7 @@ int PointTracker::POSIT(const PointModel& model, const PointOrder& order_, float float IJ0 = I0.dot(J0); float JJ0 = J0.dot(J0); float rho, theta; - if (JJ0 == II0) { + if (std::abs(JJ0 - II0) < 1e-6f) { rho = std::sqrt(std::abs(2*IJ0)); theta = -PI/4; if (IJ0<0) theta *= -1; @@ -202,7 +202,8 @@ int PointTracker::POSIT(const PointModel& model, const PointOrder& order_, float else { rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 )); theta = atan( -2*IJ0 / (JJ0-II0) ); - if (JJ0 - II0 < 0) theta += PI; + // avoid branch misprediction + theta += (JJ0 - II0 < 0) * PI; theta /= 2; } |