[Bf-blender-cvs] [b30f89918ee] master: Fix T85632 Improve Exact boolean in cell fracture of Suzanne.

Howard Trickey noreply at git.blender.org
Sun Mar 7 14:57:41 CET 2021


Commit: b30f89918ee16ae3473faa2cfaa5c843b012d878
Author: Howard Trickey
Date:   Sun Mar 7 08:54:21 2021 -0500
Branches: master
https://developer.blender.org/rBb30f89918ee16ae3473faa2cfaa5c843b012d878

Fix T85632 Improve Exact boolean in cell fracture of Suzanne.

The Exact boolean used in the cell fracture addon incorrectly
kept some outside faces: due to some raycasts going into open
eye socket then out of the head, leading to one ray direction
(out of 8) saying the face was inside the head. The current
code allowed 1 of 8 rays only as "inside" to accommodate the
case of a plane used in boolean to bisect. But this cell fracture
case needs more confidence of being inside. So changed the
test for intersection to require at least 3 of 8 rays to be inside.

Maybe the number of rays to indicate insideness should be exposed
as an option, to allow user tuning according to the degree of
"non-volumeness" of the arguments, but will try at least for now
to magically guess the right value of the rays-inside threshold.

Note: all of this only for the case where the arguments are not
all PWN (approx: manifold). The all-PWN case doesn't use raycast.

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

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

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

diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc
index fcf5c5bfad3..68d7ddec7ef 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -2542,11 +2542,12 @@ static IMesh raycast_boolean(const IMesh &tm,
        * operation, we want to be pretty sure that the point is inside other_shape.
        * E.g., T75827.
        */
-      bool need_high_confidence = (op == BoolOpType::Difference) && (shape != 0);
+      bool need_high_confidence = (op == BoolOpType::Difference && shape != 0) ||
+                                  op == BoolOpType::Intersect;
       bool inside = in_shape[other_shape] >= (need_high_confidence ? 0.5f : 0.1f);
       if (dbg_level > 0) {
         std::cout << "test point is " << (inside ? "inside" : "outside") << " other_shape "
-                  << other_shape << "\n";
+                  << other_shape << " val = " << in_shape[other_shape] << "\n";
       }
       winding[other_shape] = inside;
     }



More information about the Bf-blender-cvs mailing list