]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add operator== for pose
authorJiri Vlasak <jiri.vlasak.2@cvut.cz>
Tue, 20 Jul 2021 10:35:08 +0000 (12:35 +0200)
committerJiri Vlasak <jiri.vlasak.2@cvut.cz>
Tue, 20 Jul 2021 14:49:17 +0000 (16:49 +0200)
incl/bcar.hh
src/bcar.cc

index 095c2213ed73bc6198c0fc1f151693765bfc604a..5370934e011dc4586a9cee57415dc29fbe06a998 100644 (file)
@@ -74,6 +74,7 @@ public:
        /*! Return Euclidean distance to `p`. */
        double edist(Point const& p) const;
 
+       bool operator==(Point const& p);
        friend std::ostream& operator<<(std::ostream& out, Point const& p);
 };
 
@@ -149,6 +150,7 @@ public:
 
        void reflect(Line const& li);
 
+       bool operator==(Pose const& p);
        friend std::ostream& operator<<(std::ostream& out, Pose const& p);
 };
 
index 0cdb078b43d14461c397fd8aefcb0752eabc14b4..93f017e7cacde2038ae0cf57e3092c163c659473 100644 (file)
@@ -124,6 +124,12 @@ Point::edist(Point const& p) const
        return sqrt(pow(p.x() - this->x_, 2.0) + pow(p.y() - this->y_, 2.0));
 }
 
+bool
+Point::operator==(Point const& p)
+{
+       return this->x() == p.x() && this->y() == p.y();
+}
+
 std::ostream&
 operator<<(std::ostream& out, Point const& p)
 {
@@ -290,6 +296,12 @@ Pose::reflect(Line const& li)
        this->h(this->h() + 2.0 * dh);
 }
 
+bool
+Pose::operator==(Pose const& p)
+{
+       return this->x() == p.x() && this->y() == p.y() && this->h() == p.h();
+}
+
 std::ostream&
 operator<<(std::ostream& out, Pose const& p)
 {