]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Make more pslot methods constant
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 16 Jul 2019 11:41:33 +0000 (13:41 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 16 Jul 2019 11:41:33 +0000 (13:41 +0200)
api/pslot.h
src/pslot.cc

index f714dc174d7002960846664f830dfaec25aab4a5..3b69ecdafb6087ad85497202f1e109999fa4f183 100644 (file)
@@ -24,17 +24,17 @@ class ParkingSlot {
                 The orientation of the parking slot is computed as the
                 direction from the first to the last border coordinates.
                 */
-                double heading();
+                double heading() const;
                 /*! \brief Return `true` if slot is parallel.
 
                 There are two slot types - parallel and perpendicular.
                 */
-                bool parallel();
+                bool parallel() const;
                 /*! \brief Return `true` if slot is on the right.
 
                 The slot could be on right or the left side.
                 */
-                bool right();
+                bool right() const;
 
                 // getters, setters
                 double x1() const { return this->border_[0][0]; }
index d2ff1be32d43caff3b24d73bae4ad5f8feaa48ec..0efb39d1c7438eaf335e5e278cdd7cd3e555cee0 100644 (file)
@@ -6,12 +6,12 @@ template <typename T> int sgn(T val) {
 }
 
 // slot info
-double ParkingSlot::heading()
+double ParkingSlot::heading() const
 {
         return atan2(this->y4() - this->y1(), this->x4() - this->x1());
 }
 
-bool ParkingSlot::parallel()
+bool ParkingSlot::parallel() const
 {
         double d1 = sqrt(
                 pow(this->x2() - this->x1(), 2)
@@ -27,7 +27,7 @@ bool ParkingSlot::parallel()
                 return false;
 }
 
-bool ParkingSlot::right()
+bool ParkingSlot::right() const
 {
         if (sgn(
                 (this->x2() - this->x1()) * (this->y4() - this->y1())