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.
This commit is contained in:
parent
e72dc1e6c6
commit
b30f89918e
Notes:
blender-bot
2023-05-03 10:14:48 +02:00
Referenced by issue #85632, Problem with quickeffect cell fracture
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue