[fast-csg] Custom remeshing after corefinements#4117
Merged
t-paul merged 35 commits intoopenscad:masterfrom Mar 6, 2022
Merged
[fast-csg] Custom remeshing after corefinements#4117t-paul merged 35 commits intoopenscad:masterfrom
t-paul merged 35 commits intoopenscad:masterfrom
Conversation
This was referenced Feb 12, 2022
…k face splits) [fast-csg] Feature fast-csg-remesh to integrate the new CorefinementVisitor [fast-csg] Fix code after merge [fast-csg] Try/catch around remeshing, and track triangulation edges across splits. [fast-csg] Let remeshing exit early if no face was split [fast-csg] Beautified [fast-csg] Fix const-ness of arg that breaks compilation of the delegating visitor (change of signature between CGAL 5.3 and 5.4) [fast-csg] Implement the corefinement visitor without inheriting from the signature-changing default_visitor [fast-csg] Only remesh patches that have >1 surviving split face [fast-csg] Simpler remesh: replace faces with a polygon we let cgal triangulate In-place mutation of triangule mesh looks hard to nail so creating a copy Beautify [fast-csg] Enable remesh in tests [fast-csg] Only copy retained vertices in remeshing [fast-csg-remesh] Simplified and fixed logic. Left out coplanarity tests and patches merging. Split the visitor from the remesher, and added support for simplifying faces to the mesh edits. Dropped the generic visitor delegate but kept the idea. Merge remote-tracking branch 'origin/master' into fast-csg-remesh3
98676ec to
6a63512
Compare
added 21 commits
February 18, 2022 11:46
… + don't skip paths that didn't collapse
…l send separately)
…h sides of patch border This fixes cases of meshes becoming unclosed after remeshing. A vertex needs exactly two "marks" to be eligible for collapsing. Ditched removeItemsAtSortedIndices helper + refactored collapsePathWithConsecutiveCollinearEdges in the process.
Member
Member
|
2021.01 also has bad triangulation for that. Slightly different, but T's & degenerate faces. |
added 8 commits
March 1, 2022 19:31
…sHalfedgeOnBorder Required a little bit of refactoring of the single-patch logic into a helper function to ensure we add the facesProcessed at the end, success or not. Also refactored the patch-specific data structures (previously loopLocal*) into a struct for clarity.
…sh order (workaround for CGAL/cgal#6363)
…erimental feature b/c it's slower!!
Benchmarked:
hyperfine -L remesh ",--enable=fast-csg-remesh,--enable=fast-csg-remesh-predictibly" "./buildRelease/OpenSCAD.app/Contents/MacOS/OpenSCAD mnk.scad --enable=fast-csg --enable=fast-csg-trust-corefinement -o out.stl {remesh}"
With mnk.scad coming from openscad#4113
Mean : 38s (Baseline), 25s (remesh), 32s (remesh-predictibly)
This was referenced Mar 4, 2022
t-paul
approved these changes
Mar 6, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Remeshing logic that "fixes" the results of corefinement operations to avoid an explosion of number of faces that hangs many models.
fast-csg-remeshoperates as follows (needsfast-csg):Note: supersedes #4107 as by design it should lead to less coplanarity tests (for many faces we know they're coplanar because we know they have a common ancestor thanks to the corefinement visitor). Also this means we're not tied to the upcoming release of CGAL.
Some examples:
And some simpler ones:
This goes from 44 to 12 (instead of 12 w/ nef, which is able to figure out it's now just a "cube"):
Known limitations
fast-csg-remesh-predictiblyfeature was introduced that takes quite a bit longer to run (+30% total run time on the minkowski example mentioned above) but always starts each face from the "smallest" vertex. It is used by tests in conjunction with thesort-stlfeature I've recently introduced (Experimental sort-stl feature for stable outputs (fixes #420) #4146) so we can test stable remeshing outputs against golden STL files.