summaryrefslogtreecommitdiffstats
path: root/Vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'Vector.h')
-rw-r--r--Vector.h61
1 files changed, 0 insertions, 61 deletions
diff --git a/Vector.h b/Vector.h
deleted file mode 100644
index 49a5597..0000000
--- a/Vector.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef _VECTOR_H_
-#define _VECTOR_H_
-
-#include <cmath>
-
-class Vector {
- public:
- 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);
- }
-
- Vector& operator+=(const Vector &v) {
- x += v.x;
- y += v.y;
- z += v.z;
-
- return *this;
- }
-
- Vector operator*(float f) const {
- return Vector(x*f, y*f, z*f);
- }
-
- Vector operator/(float f) const {
- return (*this)*(1/f);
- }
-
- Vector operator-() const {
- return Vector(-x, -y, -z);
- }
-
- Vector cross(const Vector &v) const {
- return Vector(y*v.z - z*v.y,
- z*v.x - x*v.z,
- x*v.y - y*v.x);
- }
-
- 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();
- }
-
- protected:
- float x, y, z;
-};
-
-#endif /*_VECTOR_H_*/
-