- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 890
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
Create a set of extra lines to support corners of skins above. [Ready for review+merge] #2122
Create a set of extra lines to support corners of skins above. [Ready for review+merge] #2122
Conversation
Not sure whats wrong with the conan-package / conan-package-export / package-export test - but I think it unrelated to the code I added. Is it a known issue or am I doing something wrong? |
I don't think that step failing is caused by anything that you did. |
…option and tests for the same
Ultimaker/Cura#19446 needs to be merged first |
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.
Hi!
Great to see a well documented review with unit-tests. You don't see that everyday, so kudos!
As you can see, I've made some ready-to-commit code-changes w.r.t. coding-style (mostly no-brace if/for statements).
There are also a few suggestions about optimization. I don't think I'd require those to be in but please take a look anyway.
Lastly, I've tested it and will post a few quick remarks to the front-end part as well, as they seen more relevant there.
src/FffGcodeWriter.cpp
Outdated
const Shape line_shape = OpenLinesSet(line).offset(line_width / 2); | ||
for (const auto& point : points) | ||
{ | ||
if (line_shape.inside(point)) |
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 very much suspect calculating the distance to a line-segment would be a lot faster than an 'inside' check on a shape made by an expanded line.
Perhaps we can even just throw the lines in a LocToLineGrid
, then get the closest line-segment to each point we query with, to get the minimal set of line-segments.
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.
Indeed. Fixed.
In the typical case it is only a handful of points and a handful of lines, so I'll leave it with the dirty-feeling O(n^2) algorithm rather than introduce complexity, especially since a loc2LineGrid doesn't perform well with lots of long parallel lines.
src/FffGcodeWriter.cpp
Outdated
const int numAngles = 16; | ||
const double angleStep = 180.0 / numAngles; // Step size between angles | ||
|
||
for (int i = 0; i < numAngles; ++i) |
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.
Perhaps estimating the longest line you can make into that area (so that'd probably can be approximated by the longest axis of a non-axis-aligned bounding-box) then taking the angle of that line could maybe take care of the repetition here.
(I was also thinking about threading, but that probably won't do anything, since this area is already parallelized 'upstream' as it where.)
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.
This 16 iteration loop was indeed using a reasonable amount of the runtime (under 1% of the total slice time, but still tens of milliseconds), so I have rethought. We now test 2 angles in most cases, and even in extreme cases of hundreds of points to support, we won't usually test more than ~10.
On average, the selected angles are better too, although there are ~10 additional lines of code to achieve it.
Co-authored-by: Remco Burema <41987080+rburema@users.noreply.github.com>
…24/CuraEngine into Hello1024-better-infill-support
Description
Create a set of extra lines to support skins above. Fixes Ultimaker/Cura#19388
Skins above need their boundaries supported at a minimum. A straight line needs support just at the ends. A curve needs support at various points along the curve. We find these points by finding the minimal polygon which is always within line_width of the desired support.
The strategy here is to figure out what is currently printed on this layer within the infill area by taking all currently printed lines and turning them into a giant hole-y shape.
Then figure out extra infill_lines to add to support all points that are unsupported. The extra lines will always be straight and will always go between existing infill lines. The lines are integrated into the print path for the infill so that (in most cases) there will be no travel moves.
Type of change
How Has This Been Tested?
Test Configuration:
Checklist:
Initial review please!
Todo Before Merge
* Done! Now supports the end of straight lines for the LINES surface pattern, and corners of the CONCENTRIC surface pattern.