diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-12-09 23:10:31 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-12-09 23:10:31 +0100 |
commit | 4731d3f4cf576d791db21ac1932fd91f9b43ff3a (patch) | |
tree | 5f24b886f2cb3d7117e11abd2901bbe8d4720c56 /Vertex.h | |
parent | 8705ce3d468c3cd22159bc0fedf727e8250861ca (diff) | |
download | c3d-4731d3f4cf576d791db21ac1932fd91f9b43ff3a.tar c3d-4731d3f4cf576d791db21ac1932fd91f9b43ff3a.zip |
BSPTrees weiter aufbauen
Diffstat (limited to 'Vertex.h')
-rw-r--r-- | Vertex.h | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1,21 +1,24 @@ #ifndef _VERTEX_H_ #define _VERTEX_H_ -class Vertex +#include "Vector.h" + +class Vertex : public Vector { public: - Vertex(float x0 = 0, float y0 = 0, float z0 = 0) : x(x0), y(y0), z(z0) {} + Vertex(float x0 = 0, float y0 = 0, float z0 = 0) : Vector(x0, y0, z0) {} + Vertex(const Vector &v) : Vector(v) {} - float getX() const {return x;} - float getY() const {return y;} - float getZ() const {return z;} - float distanceSq(const Vertex &v) const { - return x*v.x + y*v.y + z*v.z; + Vector delta = *this - v; + + return delta.dot(delta); + } + + Vector operator-(const Vertex &v) const { + return Vector(x-v.x, y-v.y, z-v.z); } - protected: - float x, y, z; }; #endif /*_VERTEX_H_*/ |