+template<class T>
+inline Vector<T> operator /(T s, const Vector<T> &v) {
+ return Vector<T>(s / v.X(), s / v.Y());
+}
+
+template<class T>
+inline Vector<T> operator %(const Vector<T> &v1, const Vector<T> &v2) {
+ return Vector<T>(v1.X() % v2.X(), v1.Y() % v2.Y());
+}
+template<>
+inline Vector<float> operator %(const Vector<float> &v1, const Vector<float> &v2) {
+ return Vector<float>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
+}
+template<>
+inline Vector<double> operator %(const Vector<double> &v1, const Vector<double> &v2) {
+ return Vector<double>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
+}
+template<>
+inline Vector<long double> operator %(const Vector<long double> &v1, const Vector<long double> &v2) {
+ return Vector<long double>(std::fmod(v1.X(), v2.X()), std::fmod(v1.Y(), v2.Y()));
+}
+template<class T>
+inline Vector<T> operator %(const Vector<T> &v, T s) {
+ return Vector<T>(v.X() % s, v.Y() % s);
+}
+template<>
+inline Vector<float> operator %(const Vector<float> &v, float s) {
+ return Vector<float>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
+}
+template<>
+inline Vector<double> operator %(const Vector<double> &v, double s) {
+ return Vector<double>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
+}
+template<>
+inline Vector<long double> operator %(const Vector<long double> &v, long double s) {
+ return Vector<long double>(std::fmod(v.X(), s), std::fmod(v.Y(), s));
+}
+
+template<class T>
+inline bool operator ==(const Vector<T> &lhs, const Vector<T> &rhs) {
+ return lhs.X() == rhs.X() && lhs.Y() == rhs.Y();
+}
+
+template<class T>
+inline bool operator !=(const Vector<T> &lhs, const Vector<T> &rhs) {
+ return lhs.X() != rhs.X() || lhs.Y() != rhs.Y();
+}