// RRT* procedures
bool RRTS::connect()
{
+ bool conn = false;
+ RRTNode *t = &this->steered().front();
+ RRTNode *f = this->nn(this->samples().back());
+ double cost = this->cost(*f, *t);
+ for (auto n: this->nv(*t)) {
+ if (this->cost(*n, *t) < cost) {
+ f = n;
+ cost = this->cost(*n, *t);
+ }
+ }
+ this->nodes().push_back(this->steered().front());
+ this->steered().erase(this->steered().begin());
+ t = &this->nodes().back();
+ t->p(f);
+ t->c(f->c() + this->cost(*f, *t));
+ conn = true;
+ return conn;
}
void RRTS::rewire()