7 ParkingSlot::ParkingSlot(Point p, double h, double W, double L) :
9 Point(p.x() + W * cos(h - M_PI / 2.0),
10 p.y() + W * sin(h - M_PI / 2.0)),
11 Point(p.x() + W * cos(h - M_PI / 2.0) + L * cos(h),
12 p.y() + W * sin(h - M_PI / 2.0) + L * sin(h)),
13 Point(p.x() + L * cos(h), p.y() + L * sin(h))}),
14 entry_(p, border_[3]),
16 curb_(border_[1], border_[2]),
17 front_(border_[2], border_[3])
22 ParkingSlot::lfx() const
24 return this->border_[3].x();
28 ParkingSlot::lfy() const
30 return this->border_[3].y();
34 ParkingSlot::lrx() const
36 return this->border_[0].x();
40 ParkingSlot::lry() const
42 return this->border_[0].y();
46 ParkingSlot::rrx() const
48 return this->border_[1].x();
52 ParkingSlot::rry() const
54 return this->border_[1].y();
58 ParkingSlot::rfx() const
60 return this->border_[2].x();
64 ParkingSlot::rfy() const
66 return this->border_[2].y();
70 ParkingSlot::h() const
72 return atan2(this->lfy() - this->lry(), this->lfx() - this->lrx());
76 ParkingSlot::parallel() const
78 return this->entry_.len() > this->rear_.len();
82 ParkingSlot::right() const
84 return this->border_[1].on_right_side_of(this->entry_);
88 ParkingSlot::swap_side()
90 this->border_[1].rotate(this->border_[0], M_PI);
91 this->border_[2].rotate(this->border_[3], M_PI);
95 operator<<(std::ostream& o, ParkingSlot const& s)
98 o << s.border_[0] << ",";
99 o << s.border_[1] << ",";
100 o << s.border_[2] << ",";