#include "Point.hpp" #include Point::Point() : x(0), y(0) {} Point::Point(float x, float y) : x(Fixed(x)), y(Fixed(y)) {} Point::Point(Point const &other) : x(other.x), y(other.y) {} Point &Point::operator=(const Point &other) { (void)other; std::cerr << "WARNING: called Point::operator=, which is a noop due to x and " "y being const." << std::endl; return *this; }; Point::~Point() {} Fixed Point::getX() const { return x; } Fixed Point::getY() const { return y; } Fixed Point::triangleArea(Point const &a, Point const &b, Point const &c) { return (((a.x * (b.y - c.y)) + (b.x * (c.y - a.y)) + (c.x * (a.y - b.y))) / 2) .abs(); } std::ostream &operator<<(std::ostream &stream, const Point &p) { stream << "(" << p.getX() << ", " << p.getY() << ")"; return stream; }