Skip to content

[CURA-13024] Spike: merge thin parts of floor/roof/skin#2316

Open
rburema wants to merge 14 commits intomainfrom
CURA-13024_spike_merge_rooffloor_to_skin
Open

[CURA-13024] Spike: merge thin parts of floor/roof/skin#2316
rburema wants to merge 14 commits intomainfrom
CURA-13024_spike_merge_rooffloor_to_skin

Conversation

@rburema
Copy link
Copy Markdown
Member

@rburema rburema commented Apr 1, 2026

Merge roof/floor into skin or vice-versa, given a distance, where anything under this is considered 'too thin' and will be merged to the other areas when next to each other.

See frontend PR for the accompanying setting: Ultimaker/Cura#21515

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

Test Results

31 tests   31 ✅  5s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit 0c83978.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

@wawanbreton wawanbreton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The global implementation is very elegant and should indeed work without edge-cases. I have a few suggestions/requests though, to be challenged of course 🙂

Comment thread src/FffGcodeWriter.cpp Outdated
Comment thread src/FffGcodeWriter.cpp Outdated
Comment thread src/FffGcodeWriter.cpp Outdated
Comment thread src/FffGcodeWriter.cpp Outdated
rburema and others added 2 commits April 1, 2026 14:19
Most notably, rewrite mergeThinOverlap a bit to do a mostly inplace alteration of the polygons, have some extra early-out(s) and move the method to where we can re-use it later should the need arise.

part of spike CURA-13024
Copy link
Copy Markdown
Contributor

@wawanbreton wawanbreton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one more possible optimization, otherwise looks good !

Comment thread src/utils/polygonUtils.cpp Outdated
rburema and others added 5 commits April 1, 2026 15:27
CURA-13024
The previous method allowed re-growing a thin part over which we had previously grown with a higher precedence area. Now we don't allow growing the thin area with less precedence to try and get a natural result.
The merging code also has been moved to the generateSkinRoofingFlooringFill method to do it as soon as possible and avoid using inconsistent areas throughout the code.
Copy link
Copy Markdown
Member Author

@rburema rburema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two very small remarks (only one of which isn't a complete nitpick). I'm passing this along to QA again now since they're just small refactors, not functional changes, in any case.

}

// If necessary, remove the thin parts of the source to not allow them to grow (using the same principle as above)
const Shape source_grow_part = allow_thin_areas_grow ? source : source.intersection(source.offset(-max_dist).offset(max_dist + EPSILON));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's worth it (since it would become less readable), but if we really wanted to, we could prevent the copy of source to source_grow_parts in the case allow_thin_areas_grow is true (and instead make it a reference).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I completely agree, don't like this copy either, but I can't find a way to optimize it without making an ugly code...

}

// Now calculate the actual growing area, which is the intersection of the offset source with the allowed growing area
const Shape actual_grow_area = source_grow_part.offset(max_dist).intersection(allow_grow_area).offset(EPSILON);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since both source_grow_part and allow_grow_area already include EPSILON, I think you can add the epsilon to the max_dist instead here, thus avoiding the final offset operation (as those aren't the cheapest).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I like the idea, but I think that would defeat the purpose of this offset. If I do it before the intersection, the final shape will not go outside the allow_grow_area that it intersects with, which is required to properly make the subsequent union with the source.

@HellAholic HellAholic marked this pull request as ready for review May 6, 2026 08:03
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.

3 participants