]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add operator<< for point
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 14 Jul 2021 21:30:05 +0000 (23:30 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 14 Jul 2021 21:30:05 +0000 (23:30 +0200)
incl/bcar.hh
src/bcar.cc

index 0615f535d952c4334ab0a3a74b0f7b251cdb1acc..5a4e46608cc077a766441660a0ca0b957882f8b5 100644 (file)
@@ -57,6 +57,8 @@ public:
         * \param li The plane to consider is given by `li`.
         */
        bool on_right_side_of(Line const& li) const;
+
+       friend std::ostream& operator<<(std::ostream& out, Point const& p);
 };
 
 class Line {
index 492213258d6cc2da7be8ca108e4d1fd779786623..985537e61f90b250ae8e316b8961dbe0baca7102 100644 (file)
@@ -95,6 +95,13 @@ Point::on_right_side_of(Line const& li) const
        }
 }
 
+std::ostream&
+operator<<(std::ostream& out, Point const& p)
+{
+       out << "[" << p.x() << "," << p.y() << "]";
+       return out;
+}
+
 Line::Line(Point const& fp, Point const& lp): first(fp), last(lp),
                intersection1(Point(0.0, 0.0)), intersection2(Point(0.0, 0.0))
 {