Commit: 2b6bd6f76d720a3cea40ba9328f7dae5563a673c
Author: Howard Trickey
Date:   Sun Aug 9 16:16:07 2020 -0400
Branches: newboolean
https://developer.blender.org/rB2b6bd6f76d720a3cea40ba9328f7dae5563a673c

Fix the nearest point containing cell when nearest is inside a tri.

===================================================================

M       source/blender/blenlib/intern/boolean.cc

===================================================================

diff --git a/source/blender/blenlib/intern/boolean.cc 
b/source/blender/blenlib/intern/boolean.cc
index 3f57343e381..708252f864d 100644
--- a/source/blender/blenlib/intern/boolean.cc
+++ b/source/blender/blenlib/intern/boolean.cc
@@ -1502,6 +1502,10 @@ static int find_containing_cell(Vertp v,
   }
   const Face &tri = *tm.face(t);
   Edge etest;
+  if (close_edge == -1 && close_vert == -1) {
+    /* Choose any edge if closest point is inside the triangle. */
+    close_edge = 0;
+  }
   if (close_edge != -1) {
     Vertp v0 = tri[close_edge];
     Vertp v1 = tri[(close_edge + 1) % 3];
@@ -1523,10 +1527,6 @@ static int find_containing_cell(Vertp v,
   }
   else {
     int cv = close_vert;
-    if (cv == -1) {
-      /* Closest point is inside the triangle. Pick any vert for closest. */
-      cv = 0;
-    }
     Vertp vert_cv = tri[cv];
     if (vert_cv == v) {
       /* Need to use another one to find sorting edge. */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to