Skip to content

Conversation

pca006132
Copy link
Collaborator

#502 (comment)

This is an ugly hack to workaround issue #502, which seems to affect quite a lot of OpenSCAD users when they extrude from SVG and perform boolean operations.

The idea is that #502 is caused by skipping vertices incorrectly, so we try to triangulate the polygon without considering precision first, and triangulate it the second time if the first attempt failed. This makes some of the geometry checks necessary, so I modified some of the debug related code to make things compile and working without MANIFOLD_DEBUG=ON. Note that the performance with MANIFOLD_DEBUG=OFF is still very fast because we only enabled some checks in polygon.cpp, instead of all other checks that MANIFOLD_DEBUG=ON will enable.

What I am uncertain about:

  1. Should we also do this when params.overlapChecks = false?
  2. Should we merge this before we get a real fix for Difference of Cube and Complex SVG Results in Incomplete Render (openscad/openscad#4679) #502? Or should we wait a bit?

@pca006132 pca006132 requested a review from elalish July 29, 2023 18:13
@pca006132
Copy link
Collaborator Author

image
image

I tried building openscad with this patch, and it did work.

@codecov
Copy link

codecov bot commented Jul 29, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.07% 🎉

Comparison is base (7facd0e) 90.36% compared to head (09c1185) 90.44%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #507      +/-   ##
==========================================
+ Coverage   90.36%   90.44%   +0.07%     
==========================================
  Files          35       35              
  Lines        4431     4447      +16     
==========================================
+ Hits         4004     4022      +18     
+ Misses        427      425       -2     
Files Changed Coverage Δ
src/utilities/include/public.h 67.44% <ø> (+0.38%) ⬆️
src/polygon/src/polygon.cpp 90.85% <100.00%> (+1.04%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@elalish
Copy link
Owner

elalish commented Jul 29, 2023

Okay, I am more and more confused as to what this bug actually is. Is it a crash, or non-manifold output, or geometrically incorrect output? Are the images above correct or incorrect output?

@elalish
Copy link
Owner

elalish commented Jul 29, 2023

Okay, rereading the original openscad bug, I think I've answered my own question: no crash, all output is manifold, but the geometry is off because of a bad triangulation. Let me see if I can fix the underlying problem before we put in a hack. Thanks for all the effort narrowing this down!

@elalish elalish mentioned this pull request Jul 29, 2023
@pca006132 pca006132 closed this Aug 14, 2023
@pca006132 pca006132 deleted the workaround-502 branch August 15, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants