From cca533afcff88a8d286f9ac601272ec4f4eab5a2 Mon Sep 17 00:00:00 2001 From: Doug Shi-Dong Date: Thu, 26 Sep 2019 01:47:41 -0400 Subject: [PATCH] Fix get_new_point optimization. A performance-if ignores next point when current point weight = 0. However, since the current point weight is 0, we should be replacing the current point with the next point, not skipping the next point. --- source/grid/manifold.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index 5072c095af..155d34e7f8 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -101,9 +101,15 @@ Manifold::get_new_point( weight = w / (weights[permutation[i]] + w); if (std::abs(weight) > 1e-14) - p = get_intermediate_point(p, - surrounding_points[permutation[i]], - 1.0 - weight); + { + p = get_intermediate_point(p, + surrounding_points[permutation[i]], + 1.0 - weight); + } + else + { + p = surrounding_points[permutation[i]]; + } w += weights[permutation[i]]; } -- 2.39.5