From: Jiri Vlasak Date: Tue, 14 Sep 2021 11:01:26 +0000 (+0200) Subject: Fix drive in slot end condition X-Git-Tag: v0.7.0~5 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hubacji1/bcar.git/commitdiff_plain/6f57d7992a8c256710cab85800e39483b5bbd8fa Fix drive in slot end condition --- diff --git a/src/pslot.cc b/src/pslot.cc index fe6c377..4753d91 100644 --- a/src/pslot.cc +++ b/src/pslot.cc @@ -229,7 +229,12 @@ ParkingSlot::drive_in_slot(BicycleCar c) path.push_back(c); return path; } - if (c.h() < this->h()) { + double sx = c.x() + 10.0 * cos(this->h()); + double sy = c.y() + 10.0 * sin(this->h()); + double cx = c.x() + 10.0 * cos(c.h()); + double cy = c.y() + 10.0 * sin(c.h()); + if (Point(cx, cy).on_right_side_of( + Line(Point(c.x(), c.y()), Point(sx, sy)))) { return std::vector(); } c.next();