summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/point_tracker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-pt/point_tracker.cpp')
-rw-r--r--tracker-pt/point_tracker.cpp5
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;
}