This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
neofx-zoomedit/Vertex3d.cpp

35 lines
688 B
C++

#include "Vertex3d.h"
#include <math.h>
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;
}