2 This file is part of I am car.
4 I am car is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 I am car is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with I am car. If not, see <http://www.gnu.org/licenses/>.
19 #include "slotplanner.h"
21 ParallelSlot::ParallelSlot()
25 std::vector<std::vector<RRTNode *>> &ParallelSlot::cusp()
30 float ParallelSlot::DH() const
35 PolygonObstacle &ParallelSlot::slot()
41 void ParallelSlot::DH(float dh)
47 RRTNode *ParallelSlot::fposecenter()
49 if (this->slot().bnodes().front()->y() >
50 this->slot().bnodes().back()->y())
51 return this->slot().bnodes().front();
53 return this->slot().bnodes().back();
56 bool ParallelSlot::flast(RRTNode *P, bool right, int il)
61 this->fposecenter()->x(),
62 this->fposecenter()->y(),
63 this->fposecenter()->h()
67 this->fposecenter()->x(),
68 this->fposecenter()->y(),
69 this->fposecenter()->h()
72 BicycleCar *B = new BicycleCar(P->x(), P->y(), P->h());
74 p = B->move(cc, i * this->DH());
75 while (!this->slot().collide(p->frame()) && p->x() <= 0) {
76 if (p->rfx() <= 0 && p->rrx() <= 0) {
82 p = B->move(cc, i * this->DH());
85 p = B->move(cc, (i - 1) * this->DH());
86 if (p->rfx() <= 0 && p->rrx() <= 0) {
87 this->cusp().back().push_back(p);
90 this->cusp().back().push_back(p);
91 this->flast(p, !right, il + 1);