I’m using pyVista for algorithmic geometry processing, and I’ve run into a situation where the boolean_intersection filter will get into a state where it runs in an infinite loop. This appears to be due to some issue with my input geometries, as a very small changes to the input geometry will result in a near instantaneous solution to the operation.
The problem is, I can’t determine what the issue is with the geometry, so I can’t create a check for it. Can someone provide me insights into the geometrical constraints needed so the Boolean operations execute smoothly?
Here is smaple pyVista code that causes my system to go unstable:
center = [0.11034444347023964, 0.12075239826545586, 0.030008189380168915]
rad = 0.008502118016504611
box_bounds = [(0.24780755, -0.24561957, 0.11231179724929823, 0.12619280625583637, 0.12574518, -0.108702786]
sph = pv.Sphere(center=center, radius = rad).triangulate()
bpx = pv.Box(box_bounds).triangulate()
result = bpx.boolean_difference(sph)
When I run this code, the core running Python pegs at 100% and will just spin for hours with no progress.
If I change the sphere radius even in the 3rd or 4rth decimal place, this will execute in a few milliseconds.
These sizes and bounderies are determined algorithmically by other parts of the system though, and I want to pre-process them to ensure the system doesn’t go unstable.
Any ideas on what a) is going on in Boolean_difference that’s going unstable, and b) what data cleanup I can do prior to calling the function to ensure I don’t get into this mode would be greatly appreciated