]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add operator<< for line
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 15 Jul 2021 13:57:46 +0000 (15:57 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Thu, 15 Jul 2021 14:17:07 +0000 (16:17 +0200)
incl/bcar.hh
src/bcar.cc

index 64610552aa61c6ba6f1ed42cceecc75869df9598..3cef171b475cb1bd381c0aee62445b2f3044879e 100644 (file)
@@ -113,6 +113,8 @@ public:
        bool intersects_with(Point const& c, double const r);
 
        double len() const;
+
+       friend std::ostream& operator<<(std::ostream& out, Line const& li);
 };
 
 /*! Store coordinates `x`, `y`, and heading `h`. */
index 230ccbec22200d4460f9cbe6dc72916a2ec77274..7c8dd93f6fab1da00e9f590890a911ef1c14757e 100644 (file)
@@ -219,6 +219,13 @@ Line::len() const
        return sqrt(dx * dx + dy * dy);
 }
 
+std::ostream&
+operator<<(std::ostream& out, Line const& li)
+{
+       out << "[" << li.first << "," << li.last << "]";
+       return out;
+}
+
 Pose::Pose() : Point()
 {
 }