-
Notifications
You must be signed in to change notification settings - Fork 32
Use 2-pass candidate search for mesh clipping #1756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…te search. The 2-pass search uses more detailed screening than the single-pass bounding-box collision criterion, so it screens more accurately. Some repeated operations like checking overlaps and calling the primitive clipping code have been factored out to make the main loop more compact.
| TetrahedronType tets[] = {TetrahedronType(oct[0], oct[3], oct[1], oct[2]), | ||
| TetrahedronType(oct[0], oct[3], oct[2], oct[4]), | ||
| TetrahedronType(oct[0], oct[3], oct[4], oct[5]), | ||
| TetrahedronType(oct[0], oct[3], oct[5], oct[1])}; | ||
| double octVol = 0.0; | ||
| for(int i = 0; i < 4; ++i) | ||
| { | ||
| double tetVol = tets[i].signedVolume(); | ||
| SLIC_ASSERT(tetVol >= -EPS); // Tet may be degenerate but not inverted. | ||
| octVol += axom::utilities::abs(tetVol); | ||
| } | ||
| return octVol; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be implemented within the Octahedron class as Octahedron::signedVolume() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. The octs from discretizing spheres and cones should convex, but general octs may be concave. I don't know if that matters but it seems like something to think about.
| { | ||
| using ATOMIC_POL = typename axom::execution_space<ExecSpace>::atomic_policy; | ||
| constexpr bool tryFixOrientation = false; | ||
| if(screenLevel >= 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to define a ScreenLevel enum w/ meaningful names for the different levels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. It's just a way for me to do some experimentation to understand the effects of various things I was trying and to compare to similar codes. Once that is done, I believe that screening will prove to be low cost and usually helpful and I plan to remove the parameter.
Summary
MeshClipperImpl::computeClipVolumes3DTets.The 2-pass BVH candidate search is more selective than the single-pass bounding box search, because we can use a more accurate screening at the leaves. The 2-pass is implemented only for tet-screened clips in this PR. The non-screened version and the hex-screened version will be updated in a later PR. (They are less likely to be used when performance is critical.)
The re-factoring is a partial fix for issue #1704.