diff options
author | Constantin Riß <constantin.riss@dre.de> | 2009-12-09 15:59:14 +0100 |
---|---|---|
committer | Constantin Riß <constantin.riss@dre.de> | 2009-12-09 15:59:14 +0100 |
commit | 3b534c013dd072d0296ebaac434e8c943ab88c14 (patch) | |
tree | 13e3d7315ccc816a2b9d07a58e98655618177b03 /Vector.h | |
parent | 482852aceacb54879c08e6fffc909a2cc160d483 (diff) | |
download | c3d-3b534c013dd072d0296ebaac434e8c943ab88c14.tar c3d-3b534c013dd072d0296ebaac434e8c943ab88c14.zip |
Beleuchtung hinzugefügt
Diffstat (limited to 'Vector.h')
-rw-r--r-- | Vector.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -2,6 +2,7 @@ #define _VECTOR_H_ #include "Vertex.h" +#include <math.h> class Vector : public Vertex { public: @@ -33,6 +34,14 @@ class Vector : public Vertex { float dot(const Vector &v) const { return x*v.x + y*v.y + z*v.z; } + + float length() const { + return sqrtf(x*x+y*y+z*z); + } + + Vector normalize() const { + return *this/length(); + } }; static inline Vector operator-(const Vertex &v1, const Vertex &v2) { |