- OpenGL 2.1 plot using SDL2.
- `nn4` procedure - set node's heading to heading of currently comparing node.
- Add optimize path method based on [Islam2012]'s *Path Optimize* procedure.
+- Update cost method of `RRTNode` that updates cumulative costs of all
+ children.
### Changed
- Build with Ninja.
return n1->ccost() < n2->ccost();
}
+float RRTNode::update_ccost()
+{
+ std::vector<RRTNode *> s; // DFS stack
+ std::vector<RRTNode *> r; // reset visited_
+ RRTNode *tmp;
+ s.push_back(this);
+ while (s.size() > 0) {
+ tmp = s.back();
+ s.pop_back();
+ if (!tmp->visit()) {
+ r.push_back(tmp);
+ for (auto ch: tmp->children()) {
+ ch->ccost(tmp->ccost() + ch->dcost());
+ s.push_back(ch);
+ }
+ }
+ }
+ for (auto n: r)
+ n->visit(false);
+ return tmp->ccost();
+}
+
bool RRTNode::visit()
{
if (this->visited_) {