operator!=(const SGVec2<T>& v1, const SGVec2<T>& v2)
{ return ! (v1 == v2); }
+/// Return true if smaller, good for putting that into a std::map
+template<typename T>
+inline
+bool
+operator<(const SGVec2<T>& v1, const SGVec2<T>& v2)
+{
+ if (v1(0) < v2(0)) return true;
+ else if (v2(0) < v1(0)) return false;
+ else return (v1(1) < v2(1));
+}
+
+template<typename T>
+inline
+bool
+operator<=(const SGVec2<T>& v1, const SGVec2<T>& v2)
+{
+ if (v1(0) < v2(0)) return true;
+ else if (v2(0) < v1(0)) return false;
+ else return (v1(1) <= v2(1));
+}
+
+template<typename T>
+inline
+bool
+operator>(const SGVec2<T>& v1, const SGVec2<T>& v2)
+{ return operator<(v2, v1); }
+
+template<typename T>
+inline
+bool
+operator>=(const SGVec2<T>& v1, const SGVec2<T>& v2)
+{ return operator<=(v2, v1); }
+
/// Return true if equal to the relative tolerance tol
template<typename T>
inline
operator!=(const SGVec3<T>& v1, const SGVec3<T>& v2)
{ return ! (v1 == v2); }
+/// Return true if smaller, good for putting that into a std::map
+template<typename T>
+inline
+bool
+operator<(const SGVec3<T>& v1, const SGVec3<T>& v2)
+{
+ if (v1(0) < v2(0)) return true;
+ else if (v2(0) < v1(0)) return false;
+ else if (v1(1) < v2(1)) return true;
+ else if (v2(1) < v1(1)) return false;
+ else return (v1(2) < v2(2));
+}
+
+template<typename T>
+inline
+bool
+operator<=(const SGVec3<T>& v1, const SGVec3<T>& v2)
+{
+ if (v1(0) < v2(0)) return true;
+ else if (v2(0) < v1(0)) return false;
+ else if (v1(1) < v2(1)) return true;
+ else if (v2(1) < v1(1)) return false;
+ else return (v1(2) <= v2(2));
+}
+
+template<typename T>
+inline
+bool
+operator>(const SGVec3<T>& v1, const SGVec3<T>& v2)
+{ return operator<(v2, v1); }
+
+template<typename T>
+inline
+bool
+operator>=(const SGVec3<T>& v1, const SGVec3<T>& v2)
+{ return operator<=(v2, v1); }
+
/// Return true if equal to the relative tolerance tol
template<typename T>
inline
operator!=(const SGVec4<T>& v1, const SGVec4<T>& v2)
{ return ! (v1 == v2); }
+/// Return true if smaller, good for putting that into a std::map
+template<typename T>
+inline
+bool
+operator<(const SGVec4<T>& v1, const SGVec4<T>& v2)
+{
+ if (v1(0) < v2(0)) return true;
+ else if (v2(0) < v1(0)) return false;
+ else if (v1(1) < v2(1)) return true;
+ else if (v2(1) < v1(1)) return false;
+ else if (v1(2) < v2(2)) return true;
+ else if (v2(2) < v1(2)) return false;
+ else return (v1(3) < v2(3));
+}
+
+template<typename T>
+inline
+bool
+operator<=(const SGVec4<T>& v1, const SGVec4<T>& v2)
+{
+ if (v1(0) < v2(0)) return true;
+ else if (v2(0) < v1(0)) return false;
+ else if (v1(1) < v2(1)) return true;
+ else if (v2(1) < v1(1)) return false;
+ else if (v1(2) < v2(2)) return true;
+ else if (v2(2) < v1(2)) return false;
+ else return (v1(3) <= v2(3));
+}
+
+template<typename T>
+inline
+bool
+operator>(const SGVec4<T>& v1, const SGVec4<T>& v2)
+{ return operator<(v2, v1); }
+
+template<typename T>
+inline
+bool
+operator>=(const SGVec4<T>& v1, const SGVec4<T>& v2)
+{ return operator<=(v2, v1); }
+
/// Return true if equal to the relative tolerance tol
template<typename T>
inline
static Point3D fromSGGeod(const SGGeod& geod);
static Point3D fromSGGeoc(const SGGeoc& geoc);
static Point3D fromSGVec3(const SGVec3<double>& cart);
+ static Point3D fromSGVec3(const SGVec3<float>& cart);
+ static Point3D fromSGVec2(const SGVec2<double>& cart);
// Assignment operators
SGVec3d toSGVec3d(void) const;
SGVec3f toSGVec3f(void) const;
+ SGVec2f toSGVec2f(void) const;
// friends
friend Point3D operator - (const Point3D& p); // -p1
return pt;
}
+inline Point3D Point3D::fromSGVec3(const SGVec3<float>& cart)
+{
+ Point3D pt;
+ pt.setx(cart.x());
+ pt.sety(cart.y());
+ pt.setz(cart.z());
+ return pt;
+}
+
+inline Point3D Point3D::fromSGVec2(const SGVec2<double>& cart)
+{
+ Point3D pt;
+ pt.setx(cart.x());
+ pt.sety(cart.y());
+ pt.setz(0);
+ return pt;
+}
+
// ASSIGNMENT OPERATORS
inline Point3D& Point3D::operator = (const Point3D& p)
return SGVec3f(x(), y(), z());
}
+inline SGVec2f Point3D::toSGVec2f(void) const
+{
+ return SGVec2f(x(), y());
+}
+
// FRIENDS
inline Point3D operator - (const Point3D& a)