- Test planner `T2` based on RRT\* [Karaman2011] with steering from newly added
nodes to goal.
- OpenGL 2.1 plot using SDL2.
+- `nn4` procedure - set node's heading to heading of currently comparing node.
### Changed
- Build with Ninja.
}
return nn.nn;
}
+
+RRTNode *nn4(
+ std::vector<RRTNode *> (&nodes)[IYSIZE],
+ RRTNode *node,
+ float (*cost)(RRTNode *, RRTNode *))
+{
+ int iy = IYI(node->y());
+ struct mcnn nn;
+ nn.nn = nullptr;
+ nn.mc = 9999;
+ unsigned int i = 0; // vector step
+ unsigned int j = 0; // array step
+ int iyj = 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++) {
+ 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];
+ }
+ }
+ if (j > 0) {
+ iyj = (int) (iy - j);
+ if (iyj < 0)
+ iyj = 0;
+ #pragma omp parallel for reduction(minn: nn)
+ for (i = 0; i < nodes[iyj].size(); i++) {
+ 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];
+ }
+ }
+ }
+ j++;
+ }
+ return nn.nn;
+}
std::vector<RRTNode *> (&nodes)[IYSIZE],
RRTNode *node,
float (*cost)(RRTNode *, RRTNode *));
+RRTNode *nn4(
+ std::vector<RRTNode *> (&nodes)[IYSIZE],
+ RRTNode *node,
+ float (*cost)(RRTNode *, RRTNode *));
#endif