]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blobdiff - src/pslot.cc
Find entry for left parallel, too
[hubacji1/bcar.git] / src / pslot.cc
index 4644375e20c6e22871690cf62439f6ac21d40c30..64deb5b39cf5a1f4e43bb8de1dd1b54771558ae1 100644 (file)
@@ -95,6 +95,54 @@ ParkingSlot::h() const
        return atan2(this->lfy() - this->lry(), this->lfx() - this->lrx());
 }
 
+Point
+ParkingSlot::lf() const
+{
+       return Point(this->lfx(), this->lfy());
+}
+
+Point
+ParkingSlot::lr() const
+{
+       return Point(this->lrx(), this->lry());
+}
+
+Point
+ParkingSlot::rr() const
+{
+       return Point(this->rrx(), this->rry());
+}
+
+Point
+ParkingSlot::rf() const
+{
+       return Point(this->rfx(), this->rfy());
+}
+
+Line
+ParkingSlot::entry() const
+{
+       return this->entry_;
+}
+
+Line
+ParkingSlot::rear() const
+{
+       return this->rear_;
+}
+
+Line
+ParkingSlot::curb() const
+{
+       return this->curb_;
+}
+
+Line
+ParkingSlot::front() const
+{
+       return this->front_;
+}
+
 void
 ParkingSlot::set_parking_speed(double s)
 {
@@ -216,7 +264,11 @@ PoseRange
 ParkingSlot::fe(BicycleCar c)
 {
        assert(this->parallel());
-       assert(this->right());
+       bool swapped = false;
+       if (!this->right()) {
+               this->swap_side();
+               swapped = true;
+       }
        c.h(this->h());
        double clen = -this->offset_ + this->len() - c.df();
        double cw = c.w() / 2.0;
@@ -258,7 +310,12 @@ ParkingSlot::fe(BicycleCar c)
        }
        auto& c1 = entries.front().front();
        auto& c2 = entries.back().front();
-       return PoseRange(c1, c2);
+       PoseRange p(c1, c2);
+       if (swapped) {
+               this->swap_side();
+               p.reflect(this->entry_);
+       }
+       return p;
 }
 
 PoseRange