Overload operator<< for Point

This commit is contained in:
Jan Niklas Hasse 2018-05-28 13:56:27 +02:00
parent 66ff955252
commit 1271d6b848
2 changed files with 7 additions and 4 deletions

View File

@ -35,6 +35,10 @@
namespace p2t {
std::ostream& operator<<(std::ostream& out, const Point& point) {
return out << point.x << "," << point.y;
}
Triangle::Triangle(Point& a, Point& b, Point& c)
{
points_[0] = &a; points_[1] = &b; points_[2] = &c;
@ -358,10 +362,7 @@ Triangle& Triangle::NeighborAcross(const Point& opoint)
void Triangle::DebugPrint()
{
using namespace std;
cout << points_[0]->x << "," << points_[0]->y << " ";
cout << points_[1]->x << "," << points_[1]->y << " ";
cout << points_[2]->x << "," << points_[2]->y << endl;
std::cout << *points_[0] << " " << *points_[1] << " " << *points_[2] << std::endl;
}
}

View File

@ -119,6 +119,8 @@ struct Point {
};
std::ostream& operator<<(std::ostream&, const Point&);
// Represents a simple polygon's edge
struct Edge {