]> git.localhorst.tv Git - l2e.git/blob - src/geometry/Vector.h
added basic vector class + a small set of operators
[l2e.git] / src / geometry / Vector.h
1 /*
2  * Vector.h
3  *
4  *  Created on: Aug 6, 2012
5  *      Author: holy
6  */
7
8 #ifndef GEOMETRY_VECTOR_H_
9 #define GEOMETRY_VECTOR_H_
10
11 namespace geometry {
12
13 template<class Scalar>
14 class Vector {
15
16 public:
17         Vector() : x(0), y(0) { }
18         Vector(Scalar x, Scalar y) : x(x), y(y) { }
19         template<class T>
20         Vector(const Vector<T> &other) : x(other.X()), y(other.Y()) { };
21         template<class T>
22         Vector(T x, T y) : x(x), y(y) { }
23
24 public:
25         Scalar X() const { return x; }
26         Scalar Y() const { return y; }
27
28 private:
29         Scalar x, y;
30
31 };
32
33 }
34
35 #endif /* GEOMETRY_VECTOR_H_ */