]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add parking slot constructor
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 15 Jul 2021 08:54:00 +0000 (10:54 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 15 Jul 2021 08:54:00 +0000 (10:54 +0200)
incl/pslot.hh
src/pslot.cc

index 4c31b91ace096b7585e9b91f850fc11441829830..56a6f1619e447f2302f956ffb19eeb1c8dc6ff00 100644 (file)
@@ -29,6 +29,8 @@ public:
        \param L The length of the slot.
        */
        ParkingSlot(Point p, double h, double W, double L);
+       ParkingSlot(double lrx, double lry, double rrx, double rry, double rfx,
+               double rfy, double lfx, double lfy);
 
        /*! Get slot's left front x coordinate. */
        double lfx() const;
index d9f9b21a3ae79f028c36b1967ebf8f2cf654c4dd..8cf1ad950e5ab70bd93a772e2c38c69603ca5d5d 100644 (file)
@@ -11,13 +11,24 @@ ParkingSlot::ParkingSlot(Point p, double h, double W, double L) :
                        Point(p.x() + W * cos(h - M_PI / 2.0) + L * cos(h),
                                p.y() + W * sin(h - M_PI / 2.0) + L * sin(h)),
                        Point(p.x() + L * cos(h), p.y() + L * sin(h))}),
-               entry_(p, border_[3]),
-               rear_(p, border_[1]),
+               entry_(border_[0], border_[3]),
+               rear_(border_[0], border_[1]),
                curb_(border_[1], border_[2]),
                front_(border_[2], border_[3])
 {
 }
 
+ParkingSlot::ParkingSlot(double lrx, double lry, double rrx, double rry,
+               double rfx, double rfy, double lfx, double lfy) :
+                       border_({Point(lrx, lry), Point(rrx, rry),
+                               Point(rfx, rfy), Point(lfx, lfy)}),
+                       entry_(border_[0], border_[3]),
+                       rear_(border_[0], border_[1]),
+                       curb_(border_[1], border_[2]),
+                       front_(border_[2], border_[3])
+{
+}
+
 double
 ParkingSlot::lfx() const
 {