From 94c662e424fd608acb68cfb9b619640277618a31 Mon Sep 17 00:00:00 2001 From: Jiri Hubacek Date: Sat, 6 Oct 2018 21:10:25 +0200 Subject: [PATCH] Fix heading overwriting in `nn4` --- base/nn.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/base/nn.cc b/base/nn.cc index c9aea72..aa9eeaf 100644 --- a/base/nn.cc +++ b/base/nn.cc @@ -124,17 +124,20 @@ RRTNode *nn4( unsigned int i = 0; // vector step unsigned int j = 0; // array step int iyj = 0; + float oh = 0; while (nn.mc > j * IYSTEP) { iyj = (int) (iy + j); if (iyj >= IYSIZE) iyj = IYSIZE - 1; #pragma omp parallel for reduction(minn: nn) for (i = 0; i < nodes[iyj].size(); i++) { + oh = node->h(); node->h(nodes[iyj][i]->h()); if ((*cost)(nodes[iyj][i], node) < nn.mc) { nn.mc = (*cost)(nodes[iyj][i], node); nn.nn = nodes[iyj][i]; } + node->h(oh); } if (j > 0) { iyj = (int) (iy - j); @@ -142,11 +145,13 @@ RRTNode *nn4( iyj = 0; #pragma omp parallel for reduction(minn: nn) for (i = 0; i < nodes[iyj].size(); i++) { + oh = node->h(); node->h(nodes[iyj][i]->h()); if ((*cost)(nodes[iyj][i], node) < nn.mc) { nn.mc = (*cost)(nodes[iyj][i], node); nn.nn = nodes[iyj][i]; } + node->h(oh); } } j++; -- 2.39.2