From dc6e79c298ff2f7f95bfc334e56eaee9c9e14c73 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Thu, 19 Feb 2015 14:16:57 +0100
Subject: [PATCH] [MaL] Point3d::operator< needed for std::sort.

---
 MathLib/Point3d.cpp | 30 ++++++++++++++++++++++++++++++
 MathLib/Point3d.h   |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/MathLib/Point3d.cpp b/MathLib/Point3d.cpp
index dd2b543e505..7d929ef1765 100644
--- a/MathLib/Point3d.cpp
+++ b/MathLib/Point3d.cpp
@@ -15,6 +15,36 @@
 
 #include "Point3d.h"
 
+bool operator< (const MathLib::Point3d& p0, const MathLib::Point3d& p1)
+{
+	if (p0[0] > p1[0]) {
+		return false;
+	} else {
+		if (p0[0] < p1[0]) {
+			return true;
+		}
+	}
+	// => p0[0] == p1[0]
+
+	if (p0[1] > p1[1]) {
+		return false;
+	} else {
+		if (p0[1] < p1[1]) {
+			return true;
+		}
+	}
+	// => p0[1] == p1[1]
+
+	if (p0[2] > p1[2]) {
+		return false;
+	} else {
+		if (p0[2] < p1[2]) {
+			return true;
+		}
+		return false; // p0 == p1
+	}
+}
+
 bool operator<= (const MathLib::Point3d& p0, const MathLib::Point3d& p1)
 {
 	if (p0[0] > p1[0]) {
diff --git a/MathLib/Point3d.h b/MathLib/Point3d.h
index 51d5e67ca8c..75368621aa8 100644
--- a/MathLib/Point3d.h
+++ b/MathLib/Point3d.h
@@ -23,6 +23,8 @@ namespace MathLib
 typedef MathLib::TemplatePoint<double,3> Point3d;
 } // end namespace MathLib
 
+bool operator< (MathLib::Point3d const & p0, MathLib::Point3d const & p1);
+
 /**
  * lexicographic comparison of points
  */
-- 
GitLab