Skip to content
Snippets Groups Projects
Commit 1a02eeca authored by Tom Fischer's avatar Tom Fischer
Browse files

moved declaration and implementation of operator<= to namespace GeoLib

parent 994ff3c4
No related branches found
No related tags found
No related merge requests found
......@@ -16,26 +16,6 @@
#include "Point.h"
bool operator<= (const GeoLib::Point& p0, const GeoLib::Point& p1)
{
double tol (sqrt (std::numeric_limits<double>::min()));
if (fabs (p0[0]-p1[0]) > tol * fabs(p0[0])) {
if (p0[0] < p1[0]) return true;
else return false;
} else {
// assume p0[0] == p1[0]
if (fabs (p0[1]-p1[1]) > tol * fabs(p0[1])) {
if (p0[1] < p1[1]) return true;
else return false;
} else {
// assume p0[1] == p1[1] and p0[0] == p1[0]
if (p0[2] < p1[2]) return true;
else return false;
}
}
}
namespace GeoLib {
bool lessX (GeoLib::Point const & p0, GeoLib::Point const & p1)
......@@ -56,5 +36,24 @@ bool lessZ (GeoLib::Point const & p0, GeoLib::Point const & p1)
return false;
}
bool operator<= (const GeoLib::Point& p0, const GeoLib::Point& p1)
{
double tol (sqrt (std::numeric_limits<double>::min()));
if (fabs (p0[0]-p1[0]) > tol * fabs(p0[0])) {
if (p0[0] < p1[0]) return true;
else return false;
} else {
// assume p0[0] == p1[0]
if (fabs (p0[1]-p1[1]) > tol * fabs(p0[1])) {
if (p0[1] < p1[1]) return true;
else return false;
} else {
// assume p0[1] == p1[1] and p0[0] == p1[0]
if (p0[2] < p1[2]) return true;
else return false;
}
}
}
} // end namespace GeoLib
......@@ -47,11 +47,11 @@ bool lessY (Point const & p0, Point const & p1);
*/
bool lessZ (Point const & p0, Point const & p1);
}
/**
* lexicographic comparison of points
*/
bool operator<= (GeoLib::Point const & p0, GeoLib::Point const & p1);
}
#endif /* POINT_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment