]> git.localhorst.tv Git - l2e.git/blob - src/geometry/operators.h
reworked Application's state stack
[l2e.git] / src / geometry / operators.h
1 /*
2  * operators.h
3  *
4  *  Created on: Aug 6, 2012
5  *      Author: holy
6  */
7
8 #ifndef GEOMETRY_OPERATORS_H_
9 #define GEOMETRY_OPERATORS_H_
10
11 #include "Point.h"
12 #include "Vector.h"
13
14 namespace geometry {
15
16 template<class T>
17 inline Vector<T> operator +(const Vector<T> &lhs, const Vector<T> &rhs) {
18         return Vector<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
19 }
20 template<class T>
21 inline Point<T> operator +(const Point<T> &lhs, const Vector<T> &rhs) {
22         return Point<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
23 }
24
25 template<class T>
26 inline Vector<T> operator -(const Vector<T> &lhs, const Vector<T> &rhs) {
27         return Vector<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
28 }
29 template<class T>
30 inline Point<T> operator -(const Point<T> &lhs, const Vector<T> &rhs) {
31         return Point<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
32 }
33
34 template<class T>
35 inline Vector<T> operator -(const Vector<T> &v) {
36         return Vector<T>(-v.X(), -v.Y());
37 }
38
39 }
40
41 #endif /* GEOMETRY_OPERATORS_H_ */