/*! Change side of the parking slot. */
void swap_side();
+ /*! Return `true` if car `c` is parking in slot `this`. */
+ bool parked(BicycleCar const& c) const;
+
friend std::ostream& operator<<(std::ostream& o, ParkingSlot const& s);
};
this->border_[2].rotate(this->border_[3], M_PI);
}
+bool
+ParkingSlot::parked(BicycleCar const& c) const
+{
+ auto b_len = sizeof(this->border_) / sizeof(this->border_[0]);
+ std::vector<Point> b(this->border_, this->border_ + b_len);
+ return c.lf().inside_of(b) && c.lr().inside_of(b)
+ && c.rr().inside_of(b) && c.rf().inside_of(b);
+}
+
std::ostream&
operator<<(std::ostream& o, ParkingSlot const& s)
{