diff --git a/MathLib/MathTools.h b/MathLib/MathTools.h index 9ca7b1f888c9c5708cef9a4c1a6c2b727cd90b7e..e2cf0dfdc2bf12cfa428b8e466a06c58dfc06289 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 7d929ef1765bf99b61ae61f39210c76965375945..d0e3b8c3a8bafe6ecfd66f1f063a3ccd7a40c2a1 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 ebc86d6fbe1a611179a05030629bf6bd9648cdde..93aae8d66f50582adb47fb6c54de429429313f36 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_ */