#include "Vertex.h"
#include <math.h>
float Vertex::distanceSq(const Vertex &v) const {
return (x - v.x)*(x - v.x) + (y - v.y)*(y - v.y);
}
float Vertex::distance(const Vertex &v) const {
return sqrtf(distanceSq(v));
Vertex Vertex::operator+(const Vertex &v) const {
return Vertex(x + v.x, y + v.y);
Vertex Vertex::operator-(const Vertex &v) const {
return Vertex(x - v.x, y - v.y);
Vertex& Vertex::operator+=(const Vertex &v) {
x += v.x;
y += v.y;
return *this;
Vertex& Vertex::operator-=(const Vertex &v) {
x -= v.x;
y -= v.y;