]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/SGVec4.hxx
Remove fastmath funktions like discussed on the list.
[simgear.git] / simgear / math / SGVec4.hxx
index b8c78050003c266b172a4bc232b699a5de9efb09..feee964b4b5b57b68915e1be74db7f289a20ceef 100644 (file)
@@ -248,6 +248,20 @@ equivalent(const SGVec4<T>& v1, const SGVec4<T>& v2)
   return equivalent(v1, v2, tol, tol);
 }
 
+/// The euclidean distance of the two vectors
+template<typename T>
+inline
+T
+dist(const SGVec4<T>& v1, const SGVec4<T>& v2)
+{ return norm(v1 - v2); }
+
+/// The squared euclidean distance of the two vectors
+template<typename T>
+inline
+T
+distSqr(const SGVec4<T>& v1, const SGVec4<T>& v2)
+{ SGVec4<T> tmp = v1 - v2; return dot(tmp, tmp); }
+
 #ifndef NDEBUG
 template<typename T>
 inline
@@ -266,10 +280,6 @@ std::basic_ostream<char_type, traits_type>&
 operator<<(std::basic_ostream<char_type, traits_type>& s, const SGVec4<T>& v)
 { return s << "[ " << v(0) << ", " << v(1) << ", " << v(2) << ", " << v(3) << " ]"; }
 
-/// Two classes doing actually the same on different types
-typedef SGVec4<float> SGVec4f;
-typedef SGVec4<double> SGVec4d;
-
 inline
 SGVec4f
 toVec4f(const SGVec4d& v)