]> git.localhorst.tv Git - l2e.git/blobdiff - src/geometry/Vector.h
added basic vector class + a small set of operators
[l2e.git] / src / geometry / Vector.h
diff --git a/src/geometry/Vector.h b/src/geometry/Vector.h
new file mode 100644 (file)
index 0000000..d7d0f3d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Vector.h
+ *
+ *  Created on: Aug 6, 2012
+ *      Author: holy
+ */
+
+#ifndef GEOMETRY_VECTOR_H_
+#define GEOMETRY_VECTOR_H_
+
+namespace geometry {
+
+template<class Scalar>
+class Vector {
+
+public:
+       Vector() : x(0), y(0) { }
+       Vector(Scalar x, Scalar y) : x(x), y(y) { }
+       template<class T>
+       Vector(const Vector<T> &other) : x(other.X()), y(other.Y()) { };
+       template<class T>
+       Vector(T x, T y) : x(x), y(y) { }
+
+public:
+       Scalar X() const { return x; }
+       Scalar Y() const { return y; }
+
+private:
+       Scalar x, y;
+
+};
+
+}
+
+#endif /* GEOMETRY_VECTOR_H_ */