From 6c09d8681c73cd3b21ab1bb8e587bd1633e777b9 Mon Sep 17 00:00:00 2001 From: AndreiCostinescu Date: Fri, 12 Oct 2018 19:10:18 -0400 Subject: [PATCH] Fixed warning in SmartRangeFactor.h --- gtsam_unstable/slam/SmartRangeFactor.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/gtsam_unstable/slam/SmartRangeFactor.h b/gtsam_unstable/slam/SmartRangeFactor.h index 3164b360e..08f6bf6ce 100644 --- a/gtsam_unstable/slam/SmartRangeFactor.h +++ b/gtsam_unstable/slam/SmartRangeFactor.h @@ -121,17 +121,18 @@ class SmartRangeFactor: public NoiseModelFactor { // use best fh to find actual intersection points if (bestCircle2 && best_fh) { - std::list intersections = circleCircleIntersection( - circle1.center, bestCircle2->center, best_fh); + auto bestCircleCenter = bestCircle2->center; + std::list intersections = circleCircleIntersection( + circle1.center, bestCircleCenter, best_fh); - // pick winner based on other measurements - double error1 = 0, error2 = 0; - Point2 p1 = intersections.front(), p2 = intersections.back(); - for (const Circle2& it : circles) { - error1 += distance2(it.center, p1); - error2 += distance2(it.center, p2); - } - return (error1 < error2) ? p1 : p2; + // pick winner based on other measurements + double error1 = 0, error2 = 0; + Point2 p1 = intersections.front(), p2 = intersections.back(); + for (const Circle2& it : circles) { + error1 += distance2(it.center, p1); + error2 += distance2(it.center, p2); + } + return (error1 < error2) ? p1 : p2; } else { throw std::runtime_error("triangulate failed"); }