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 /Vector.h | |
parent | 8705ce3d468c3cd22159bc0fedf727e8250861ca (diff) | |
download | c3d-4731d3f4cf576d791db21ac1932fd91f9b43ff3a.tar c3d-4731d3f4cf576d791db21ac1932fd91f9b43ff3a.zip |
BSPTrees weiter aufbauen
Diffstat (limited to 'Vector.h')
-rw-r--r-- | Vector.h | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -1,14 +1,16 @@ #ifndef _VECTOR_H_ #define _VECTOR_H_ -#include "Vertex.h" -#include <math.h> +#include <cmath> -class Vector : public Vertex { +class Vector { public: - Vector(float x0 = 0, float y0 = 0, float z0 = 0) : Vertex(x0, y0, z0) {} - Vector(const Vertex &v) : Vertex(v) {} + Vector(float x0 = 0, float y0 = 0, float z0 = 0) : x(x0), y(y0), z(z0) {} + float getX() const {return x;} + float getY() const {return y;} + float getZ() const {return z;} + Vector operator+(const Vector &v) const { return Vector(x+v.x, y+v.y, z+v.z); } @@ -50,11 +52,10 @@ class Vector : public Vertex { Vector normalize() const { return *this/length(); } -}; -static inline Vector operator-(const Vertex &v1, const Vertex &v2) { - return Vector(v1.getX()-v2.getX(), v1.getY()-v2.getY(), v1.getZ()-v2.getZ()); -} + protected: + float x, y, z; +}; #endif /*_VECTOR_H_*/ |