From 844d60818560f779f84e6f5390a6261e70d3740c Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Fri, 17 Jul 2015 16:40:38 +0200
Subject: [PATCH] [MaL] Move Point3d operators...

into Point3d header file.
---
 MathLib/MathTools.h | 10 ----------
 MathLib/Point3d.cpp |  4 ++++
 MathLib/Point3d.h   | 13 ++++++++++++-
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/MathLib/MathTools.h b/MathLib/MathTools.h
index 9ca7b1f888c..e2cf0dfdc2b 100644
--- a/MathLib/MathTools.h
+++ b/MathLib/MathTools.h
@@ -23,8 +23,6 @@
 #include <omp.h>
 #endif
 
-#include "Point3d.h"
-
 namespace MathLib
 {
 /**
@@ -107,14 +105,6 @@ void crossProd (const double u[3], const double v[3], double r[3]);
 double calcProjPntToLineAndDists(const double p[3], const double a[3],
                                  const double b[3], double &lambda, double &d0);
 
-/// Computes the squared dist between the two points p0 and p1.
-inline
-double sqrDist(MathLib::Point3d const& p0, MathLib::Point3d const& p1)
-{
-	const double v[3] = {p1[0] - p0[0], p1[1] - p0[1], p1[2] - p0[2]};
-	return scalarProduct<double,3>(v,v);
-}
-
 /** squared dist between double arrays p0 and p1 (size of arrays is 3) */
 inline
 double sqrDist(const double* p0, const double* p1)
diff --git a/MathLib/Point3d.cpp b/MathLib/Point3d.cpp
index 7d929ef1765..d0e3b8c3a8b 100644
--- a/MathLib/Point3d.cpp
+++ b/MathLib/Point3d.cpp
@@ -15,6 +15,9 @@
 
 #include "Point3d.h"
 
+namespace MathLib
+{
+
 bool operator< (const MathLib::Point3d& p0, const MathLib::Point3d& p1)
 {
 	if (p0[0] > p1[0]) {
@@ -101,3 +104,4 @@ bool lessEq(const MathLib::Point3d& p0, const MathLib::Point3d& p1, double tol)
 	}
 }
 
+}	// namespace MathLib
diff --git a/MathLib/Point3d.h b/MathLib/Point3d.h
index ebc86d6fbe1..93aae8d66f5 100644
--- a/MathLib/Point3d.h
+++ b/MathLib/Point3d.h
@@ -17,11 +17,11 @@
 #include <limits>
 
 #include "TemplatePoint.h"
+#include "MathTools.h"
 
 namespace MathLib
 {
 typedef MathLib::TemplatePoint<double,3> Point3d;
-} // end namespace MathLib
 
 bool operator< (MathLib::Point3d const & p0, MathLib::Point3d const & p1);
 
@@ -60,5 +60,16 @@ inline MathLib::Point3d operator*(MATRIX const& mat, MathLib::Point3d const& p)
     return new_p;
 }
 
+/** Computes the squared dist between the two points p0 and p1.
+ */
+inline
+double sqrDist(MathLib::Point3d const& p0, MathLib::Point3d const& p1)
+{
+	const double v[3] = {p1[0] - p0[0], p1[1] - p0[1], p1[2] - p0[2]};
+	return MathLib::scalarProduct<double,3>(v,v);
+}
+
+} // end namespace MathLib
+
 #endif /* POINT3D_H_ */
 
-- 
GitLab