}
void
-RRTNode::p(RRTNode& p, bool connecting_goal)
+RRTNode::p(RRTNode& p, bool can_be_too_close)
{
assert(this != &p);
- if (!connecting_goal) {
+ if (!can_be_too_close) {
assert(!(std::abs(p.x() - this->x()) < 1e-3
&& std::abs(p.y() - this->y()) < 1e-3
&& std::abs(p.h() - this->h()) < 1e-3));
void
RRTS::recompute_cc_for_predecessors_and(RRTNode* g)
{
- assert(this->_path.size() == 0);
+ std::vector<RRTNode*> path;
+ path.reserve(this->_path.size());
while (g != nullptr) {
- this->_path.push_back(g);
+ path.push_back(g);
g = g->p();
}
- std::reverse(this->_path.begin(), this->_path.end());
- for (unsigned int i = 1; i < this->_path.size(); i++) {
- this->_path[i]->c(this->cost_build(
- *this->_path[i - 1],
- *this->_path[i]));
+ std::reverse(path.begin(), path.end());
+ for (unsigned int i = 1; i < path.size(); i++) {
+ path[i]->c(this->cost_build(*path[i - 1], *path[i]));
}
- this->_path.clear();
}
void