Skip to content
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

Improve ExtrusionLine::simplify, eliminating many very-short extrusion segments which led to blemishes in thin-wall models sliced with arachne #11811

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

sethml
Copy link

@sethml sethml commented Dec 1, 2023

This change makes ExtrusionLine::simplify() able to remove more very-short segments, which arachne seems to tend to produce frequently on thin-walled models with curvature. Interestingly, Cura does not seem to have this problem. From what I can see, when Arachne was ported over from Cura, a significant amount of logic was added to polyline simplification, but some of that logic was flawed. In particular, the simplification code in Cura seems to be in PolygonRef::simplify(), but during porting logic was added to avoid removing a point prior to a long segment and instead replace the two prior points with the intersection of the prior and next segments, but only if that intersection does not move the points too much. Unfortunately that test compared the intersection to the point at the other end of the long segment, thus the length test would always fail and the point would never be removed.

I made the following changes:

  • When considering replacing two points with the intersection of the adjoining segments, test the distance between the intersection and the two points prev and current, rather than prev and next. This change removes most extrusion blemishes around the perimeter.
  • For a closed polygon, allow removing the first/last point (which are the same). This can remove a single extrusion blemish per perimeter. In order to do so, we consider removing the last point, and pull the next and next_next points from the second and third points of the newly-filtered path.

While working with this code I noticed a few potential issues/future improvements:

  • As points are removed or replaced, their width is not updated. In most cases this probably results in negligible errors. However, I could imagine that if a point is removed between two nearly-collinear long segments and the segments have different widths, significant error could be introduced. Consider either not merging segments with significant width differences, and/or updating widths with a length-weighted average when merging segments.
  • Why is arachne generating so many nearly-zero-length segments in the first place? Consider changing it to no longer do so. Given that the nearly-zero-length segments seem to have a slightly different width than neighboring segments, I suspect that whatever heuristics arachne uses to determine width are generating these.
  • The logic is pretty complex and challenging to reason about. Perhaps going back to simpler simplification logic such as Cura uses would produce more consistent results.

I believe this fixes #11807. Here's a photo of the model from that issue with this change:
PXL_20231201_052558340

I think it probably also fixes #11573. I'll do a test in a moment.

@mfish38
Copy link

mfish38 commented Dec 16, 2023

I just did a test print using the dev build of SoftFever/OrcaSlicer#3014 and can confirm that this change fixes #11573.

vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 23, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 24, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 25, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 26, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 26, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 26, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 26, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 27, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 27, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Dec 27, 2023
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 1, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 3, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 4, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 5, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 8, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 13, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 13, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 14, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 16, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 17, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jan 19, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Feb 26, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Feb 27, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 8, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 24, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 26, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Mar 29, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Apr 18, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Apr 23, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request May 7, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request May 7, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request May 7, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jun 1, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jun 8, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jun 13, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jun 14, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jun 16, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jun 21, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jun 23, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Jun 27, 2024
vovodroid added a commit to vovodroid/PrusaSlicer that referenced this pull request Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thin walls with arachne have tiny moves causing blemishes Garbage G-Code segments causing printing artifacts
3 participants