From e64cf12f6645c1614d257ff0491f24d3ae99c3bc Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Mon, 19 Jul 2021 13:28:01 +0200 Subject: [PATCH] Add recompute entry method --- incl/pslot.hh | 8 ++++++++ src/pslot.cc | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/incl/pslot.hh b/incl/pslot.hh index 1562631..c45e380 100644 --- a/incl/pslot.hh +++ b/incl/pslot.hh @@ -105,6 +105,14 @@ public: */ PoseRange fe(BicycleCar c, unsigned int& max); + /*! \brief Recompute zero slot's `PoseRange` entry for `this`. + * + * The _zero_ slot is the `ParkingSlot(Point(0.0, 0.0), 0.0, W, L);`. + * + * \param p Computed `PoseRange` entry. + */ + PoseRange recompute_entry(PoseRange p); + friend std::ostream& operator<<(std::ostream& o, ParkingSlot const& s); }; diff --git a/src/pslot.cc b/src/pslot.cc index ec88e63..773394b 100644 --- a/src/pslot.cc +++ b/src/pslot.cc @@ -259,6 +259,18 @@ ParkingSlot::fe(BicycleCar c, unsigned int& max) return pr; } +PoseRange +ParkingSlot::recompute_entry(PoseRange p) +{ + p.rotate(Point(0.0, 0.0), this->h()); + p.x(p.x() + this->lrx()); + p.y(p.y() + this->lry()); + if (!this->right()) { + p.reflect(this->entry_); + } + return p; +} + std::ostream& operator<<(std::ostream& o, ParkingSlot const& s) { -- 2.39.2