summaryrefslogtreecommitdiffstats
path: root/Vertex.h
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-12-09 23:10:31 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-12-09 23:10:31 +0100
commit4731d3f4cf576d791db21ac1932fd91f9b43ff3a (patch)
tree5f24b886f2cb3d7117e11abd2901bbe8d4720c56 /Vertex.h
parent8705ce3d468c3cd22159bc0fedf727e8250861ca (diff)
downloadc3d-4731d3f4cf576d791db21ac1932fd91f9b43ff3a.tar
c3d-4731d3f4cf576d791db21ac1932fd91f9b43ff3a.zip
BSPTrees weiter aufbauen
Diffstat (limited to 'Vertex.h')
-rw-r--r--Vertex.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/Vertex.h b/Vertex.h
index 665430d..801d029 100644
--- a/Vertex.h
+++ b/Vertex.h
@@ -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_*/