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