4 template <typename T> int sgn(T val) {
5 return (T(0) < val) - (val < T(0));
9 double ParkingSlot::heading() const
11 return atan2(this->y4() - this->y1(), this->x4() - this->x1());
14 bool ParkingSlot::parallel() const
17 pow(this->x2() - this->x1(), 2)
18 + pow(this->y2() - this->y1(), 2)
21 pow(this->x3() - this->x2(), 2)
22 + pow(this->y3() - this->y2(), 2)
30 bool ParkingSlot::right() const
33 (this->x2() - this->x1()) * (this->y4() - this->y1())
34 - (this->y2() - this->y1()) * (this->x4() - this->x1())
41 ParkingSlot::ParkingSlot()