]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add recompute entry method
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 19 Jul 2021 11:28:01 +0000 (13:28 +0200)
committerJiri Vlasak <jiri.vlasak.2@cvut.cz>
Tue, 20 Jul 2021 14:49:17 +0000 (16:49 +0200)
incl/pslot.hh
src/pslot.cc

index 1562631eb842d74b924909259a084501464a8926..c45e3806d0eded14e9839418280f73979c3fb12e 100644 (file)
@@ -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);
 };
 
index ec88e634f8bea7861a16d6028a8b956d15702228..773394b94c1ae83abfb63de8774fa023a8697cb8 100644 (file)
@@ -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)
 {