diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2021-03-07 16:54:21 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2021-03-07 16:55:11 +0300 |
commit | b30f89918ee16ae3473faa2cfaa5c843b012d878 (patch) | |
tree | 13d75f92b3befae24093b71e946d28728089f3c5 /source/blender/blenlib/intern/mesh_boolean.cc | |
parent | e72dc1e6c69ef22dbec8c6c17d7a4e309d362e9e (diff) |
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.
Diffstat (limited to 'source/blender/blenlib/intern/mesh_boolean.cc')
-rw-r--r-- | source/blender/blenlib/intern/mesh_boolean.cc | 5 |
1 files changed, 3 insertions, 2 deletions
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; } |