From 947cae335b287c5da6858f6de6901cf8dbcc88d0 Mon Sep 17 00:00:00 2001 From: tizianoGuadagnino Date: Tue, 12 Nov 2024 12:10:40 +0100 Subject: [PATCH] Remove ternary operator and make the two functions consistent --- .../correspondence_threshold/CorrespondenceThreshold.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/kinematic_icp/correspondence_threshold/CorrespondenceThreshold.cpp b/cpp/kinematic_icp/correspondence_threshold/CorrespondenceThreshold.cpp index 73f3bf8..a1fa59c 100644 --- a/cpp/kinematic_icp/correspondence_threshold/CorrespondenceThreshold.cpp +++ b/cpp/kinematic_icp/correspondence_threshold/CorrespondenceThreshold.cpp @@ -47,9 +47,11 @@ CorrespondenceThreshold::CorrespondenceThreshold(const double map_discretization num_samples_(1e-8) {} double CorrespondenceThreshold::ComputeThreshold() const { + if (!use_adaptive_threshold_) return fixed_threshold_; + const double moder_error_variance = std::sqrt(model_sse_ / num_samples_); const double adaptive_threshold = 3.0 * (map_discretization_error_ + moder_error_variance); - return use_adaptive_threshold_ ? adaptive_threshold : fixed_threshold_; + return adaptive_threshold; } void CorrespondenceThreshold::UpdateModelError(const Sophus::SE3d ¤t_deviation) {