From 916c5748a8a15ca97462f4b6a6a1e4c8f0ac60c8 Mon Sep 17 00:00:00 2001
From: Jan Schnathmeier <jschnathmeier@veil.informatik.rwth-aachen.de>
Date: Thu, 12 Mar 2020 14:57:13 +0100
Subject: [PATCH] Use legacy retracing method where the new one fails in
 IsotropicRemesher

#37
---
 IsotropicRemesher.cc | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/IsotropicRemesher.cc b/IsotropicRemesher.cc
index c0981cb..213e586 100644
--- a/IsotropicRemesher.cc
+++ b/IsotropicRemesher.cc
@@ -628,7 +628,20 @@ void IsotropicRemesher::SmoothVertexVWD(Embedding *embedding,
     ++it;
   }
   //qDebug() << "Relocating vertex " << mvh.idx();
-  embedding->Relocate(mvh, bvhmin);
+  // The new, faster relocate method sadly cannot yet handle complex patches.
+  // Make sure to use the old method if a patch is complex, so check that here.
+  bool simple = true;
+  for (auto moh : meta_mesh->voh_range(mvh)) {
+    auto mvhit = meta_mesh->to_vertex_handle(moh);
+    if (mvhit == mvh) {
+      simple = false;
+    }
+  }
+  if (simple) {
+    embedding->Relocate(mvh, bvhmin);
+  } else {
+    embedding->Relocate(mvh, bvhmin, false);
+  }
   if (embedding->ErrStatus()) {
     qDebug() << "Relocation failed for vertex " << mih_list.front().idx();
     debug_hard_stop_ = true;
@@ -934,8 +947,7 @@ void IsotropicRemesher::Straightening(Embedding *embedding, StraighteningType st
           facetype ft = noselfedgesdisc;
           for (auto moh : meta_mesh->voh_range(mvh)) {
             auto mvhit = meta_mesh->to_vertex_handle(moh);
-            if (mvhit == mvh
-                || mvhit == meta_mesh->from_vertex_handle(moh)) {
+            if (mvhit == mvh) {
               ft = selfedgesorhighergenus;
             }
             if (meta_mesh->is_boundary(meta_mesh->to_vertex_handle(moh))
-- 
GitLab