]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blob - api/pslot.h
Add slot border getter/setter
[hubacji1/bcar.git] / api / pslot.h
1 #ifndef PSLOT_H
2 #define PSLOT_H
3
4 /*! \brief Parking slot basic class.
5
6 This class contains some geometrical computations of parking slot. Parking slot
7 consists of 4 cartesian coordinates `border` representing the border of the
8 parking slot.
9
10 \param border Array of 4 `x`, `y` values - the borderd of the parking slot.
11 */
12 class ParkingSlot {
13         private:
14                 double border_[4][2] = {
15                         {0, 0},
16                         {1, 0},
17                         {1, 2},
18                         {0, 2}
19                 };
20         public:
21                 // getters, setters
22                 double x1() const { return this->border_[0][0]; }
23                 double y1() const { return this->border_[0][1]; }
24                 double x2() const { return this->border_[1][0]; }
25                 double y2() const { return this->border_[1][1]; }
26                 double x3() const { return this->border_[2][0]; }
27                 double y3() const { return this->border_[2][1]; }
28                 double x4() const { return this->border_[3][0]; }
29                 double y4() const { return this->border_[3][1]; }
30                 /*! \brief Set parking slot border.
31
32                 \param x1 First `x` coordinate.
33                 \param y1 First `y` coordinate.
34                 \param x2 Second `x` coordinate.
35                 \param y2 Second `y` coordinate.
36                 \param x3 Third `x` coordinate.
37                 \param y3 Third `y` coordinate.
38                 \param x4 The last (fourth) `x` coordinate.
39                 \param y4 The last (fourth) `y` coordinate.
40                 */
41                 void border(
42                         double x1, double y1,
43                         double x2, double y2,
44                         double x3, double y3,
45                         double x4, double y4
46                 ) {
47                         this->border_[0][0] = x1;
48                         this->border_[0][1] = y1;
49                         this->border_[1][0] = x2;
50                         this->border_[1][1] = y2;
51                         this->border_[2][0] = x3;
52                         this->border_[2][1] = y3;
53                         this->border_[3][0] = x4;
54                         this->border_[3][1] = y4;
55                 };
56
57                 ParkingSlot();
58 };
59
60 #endif /* PSLOT_H */