quickhull/Point.h
karl d1d170f558 Some work on Quickhull
Also added basic arithmetic to Point, and a class for a Line
2020-11-28 20:47:52 +01:00

48 lines
733 B
C++

#pragma once
class Point
{
private:
float m_x, m_y;
public:
Point(float x, float y) : m_x(x), m_y(y) {}
Point() : m_x(0), m_y(0) {}
float x() const
{
return m_x;
}
float y() const
{
return m_y;
}
Point operator+(const Point &other)
{
return Point(x() + other.x(), y() + other.y());
}
Point operator-(const Point &other)
{
return Point(x() - other.x(), y() - other.y());
}
Point &operator+=(const Point &other)
{
m_x += other.x();
m_y += other.y();
return *this;
}
Point &operator-=(const Point &other)
{
m_x -= other.x();
m_y -= other.y();
return *this;
}
};