+BicycleCar *ParallelSlot::flncr(BicycleCar *B)
+{
+ // TODO find last not colliding
+ // for now just copy flast()
+ RRTNode *cc;
+ if (int(B->s()) % 2 == 0)
+ cc = BicycleCar(B->x(), B->y(), B->h()).ccr();
+ else
+ cc = BicycleCar(B->x(), B->y(), B->h()).ccl();
+ BicycleCar *p;
+ int i = 1;
+ p = B->move(cc, i * this->DH());
+ while (!this->slot().collide(p->frame())
+ && (
+ (this->DH() > 0 && p->x() >= 0)
+ || (this->DH() < 0 && p->lfx() <= 0)
+ )) {
+ delete p;
+ i += 10;
+ p = B->move(cc, i * this->DH());
+ }
+ i -= 10;
+ p = B->move(cc, i * this->DH());
+ while (!this->slot().collide(p->frame())) {
+ if (this->DH() > 0 && p->x() <= 0) {
+ i += 1;
+ break;
+ }
+ if (this->DH() < 0 && p->lfx() >= 0) {
+ i += 1;
+ break;
+ }
+ delete p;
+ i += 1;
+ p = B->move(cc, i * this->DH());
+ }
+ delete p;
+ return B->move(cc, (i - 1) * this->DH());
+}
+