]> 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 296fad7c07f4a7d17fa44c36f518aca2e442c23d..feee964b4b5b57b68915e1be74db7f289a20ceef 100644 (file)
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Library General Public License for more details.
 //
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the
-// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA  02111-1307, USA.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 
 #ifndef SGVec4_H
@@ -249,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
@@ -267,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)