From 99a7d349f202de317cf6aa26080974e0ab42a7df Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 4 Nov 2015 14:12:27 +0100
Subject: [PATCH] [MaL] Impl. of sqrDist2d.

---
 MathLib/Point3d.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MathLib/Point3d.h b/MathLib/Point3d.h
index 938bf88807e..f658e1c8a55 100644
--- a/MathLib/Point3d.h
+++ b/MathLib/Point3d.h
@@ -50,6 +50,14 @@ double sqrDist(MathLib::Point3d const& p0, MathLib::Point3d const& p1)
 	return MathLib::scalarProduct<double,3>(v,v);
 }
 
+/// Computes the squared distance between the orthogonal projection of the two
+/// points \c p0 and \c p1 onto the \f$xy\f$-plane.
+inline
+double sqrDist2d(MathLib::Point3d const& p0, MathLib::Point3d const& p1)
+{
+	return (p0[0]-p1[0])*(p0[0]-p1[0]) + (p0[1]-p1[1])*(p0[1]-p1[1]);
+}
+
 } // end namespace MathLib
 
 #endif /* POINT3D_H_ */
-- 
GitLab