How to increase speed/performance of boolean operations ? #8120
-
EXPLAINATIONHello, I'm currently developping an algorithm that transforms a mesh into a primitive volume. To do so, I start by dividing a bounding box around the mesh into 8 equal parts.
Finally, we assemble these parts to reconstruct the primitive shape, only composed of hexahedrons. MY QUESTIONAs this needs to do a lot of boolean operations, such as intersections to check volume and then compare to thresholds, I want to optimize the speed of these boolean operations. Is there a way to do that ? OTHER INFORMATIONS
MY CODEmain function:
process_reshape function (Recursive function to keep or reject child):
divide_equally function (divide an hexahedron into 8 children):
makeHexahedron function (create hexahedron using min and max coordinates):
calculate_min_max_coord function (Compute min and max coordinates of a mesh):
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It seems that one step could be replaced by what is done here, with an updated version of this class (currently in master branch, to be released in CGAL 6.0). You'll then be restricted to a smaller set of faces which can already improve the speed of the Boolean operation. I don't have to much time now but I'll have a closer look at your code later. One thing that might be worth investigating is to use Monte Carlo to estimate the volume. Basically you can generate a sampling inside the volume. Then you can estimate the volume by counting the number of points inside. To do so, sample the cube using this class and using |
Beta Was this translation helpful? Give feedback.
-
I implemented the Monte Carlo to see how well it performs and it's pretty fast.
|
Beta Was this translation helpful? Give feedback.
I implemented the Monte Carlo to see how well it performs and it's pretty fast.