From c6cf0b0958ddbb417114f5ca50371bc15802da42 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Thu, 15 Sep 2022 16:32:29 +0200
Subject: [PATCH] [MeL] Use exact predicates for point projection

Previously using inexact predicates would yield ambiguous results whether a point
is inside or outside of a projected element, depending on compiler and architecture.

The exact predicates are slower, so one could think about to add a run-time flag to
use exact or inexact predicates giving the user an option for fast or correct calculations.
---
 MeshLib/MeshEditing/ProjectPointOnMesh.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/MeshLib/MeshEditing/ProjectPointOnMesh.cpp b/MeshLib/MeshEditing/ProjectPointOnMesh.cpp
index 3ad783949cb..f6088c13644 100644
--- a/MeshLib/MeshEditing/ProjectPointOnMesh.cpp
+++ b/MeshLib/MeshEditing/ProjectPointOnMesh.cpp
@@ -21,10 +21,8 @@ namespace ProjectPointOnMesh
 Element const* getProjectedElement(std::vector<const Element*> const& elements,
                                    MathLib::Point3d const& node)
 {
-    auto is_right_of = [&node](Node const& a, Node const& b) {
-        return GeoLib::getOrientationFast(node, a, b) ==
-               GeoLib::Orientation::CW;
-    };
+    auto is_right_of = [&node](Node const& a, Node const& b)
+    { return GeoLib::getOrientation(node, a, b) == GeoLib::Orientation::CW; };
 
     for (auto const* e : elements)
     {
-- 
GitLab