+/*
+ * operators.h
+ *
+ * Created on: Aug 6, 2012
+ * Author: holy
+ */
+
+#ifndef GEOMETRY_OPERATORS_H_
+#define GEOMETRY_OPERATORS_H_
+
+#include "Point.h"
+#include "Vector.h"
+
+namespace geometry {
+
+template<class T>
+inline Vector<T> operator +(const Vector<T> &lhs, const Vector<T> &rhs) {
+ return Vector<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
+}
+template<class T>
+inline Point<T> operator +(const Point<T> &lhs, const Vector<T> &rhs) {
+ return Point<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
+}
+
+template<class T>
+inline Vector<T> operator -(const Vector<T> &lhs, const Vector<T> &rhs) {
+ return Vector<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
+}
+template<class T>
+inline Point<T> operator -(const Point<T> &lhs, const Vector<T> &rhs) {
+ return Point<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
+}
+
+template<class T>
+inline Vector<T> operator -(const Vector<T> &v) {
+ return Vector<T>(-v.X(), -v.Y());
+}
+
+}
+
+#endif /* GEOMETRY_OPERATORS_H_ */