Skip to content

Handle polygon vertex intersections without false crossings - #2393

Closed
Erwan MATHIEU (wawanbreton) with Copilot wants to merge 4 commits into
CURA-13352_single-non-bridging-linefrom
copilot/fix-code-review-suggestion
Closed

Erwan MATHIEU (wawanbreton) with Copilot wants to merge 4 commits into
CURA-13352_single-non-bridging-linefrom
copilot/fix-code-review-suggestion

Conversation

Copilot AI commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate edge intersections at polygon vertices were being collapsed into a single crossing, incorrectly changing extrusion override occupancy when a segment only touched a vertex.

  • Intersection handling
    • Preserve all vertex-generated intersections.
    • Classify occupancy immediately before and after each hit.
    • Update override state only according to the actual geometric transition.
const bool before = area.inside(position_before, true);
const bool after = area.inside(position_after, true);
areas_under_segments[index] = after;

Co-authored-by: wawanbreton <601114+wawanbreton@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code based on review comment Handle polygon vertex intersections without false crossings Sep 29, 2026

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.

Copilot Doing a double inside() call for every intersection seems a bit too much calculation, especially since this function is called for every single extrusion segment. Can you make a version that would be more optimized ?

Co-authored-by: wawanbreton <601114+wawanbreton@users.noreply.github.com>

Copilot AI commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Copilot Doing a double inside() call for every intersection seems a bit too much calculation, especially since this function is called for every single extrusion segment. Can you make a version tha...

Optimized in commit a3f5d9e: ordinary single-edge intersections now use the existing toggle path, while only clustered near-equal vertex hits perform one inside() classification.

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, this is still a bit reducing: the intersections cluster could actually be spread over multiple override areas. In order to be complete, you should implement a loop that goes over the intersections lists and keeps adding elements to the clusters as long as it find any element that is at a distance of actual_last_intersection+epsilon_factor.

Co-authored-by: wawanbreton <601114+wawanbreton@users.noreply.github.com>

Copilot AI commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Well, this is still a bit reducing: the intersections cluster could actually be spread over multiple override areas. In order to be complete, you should implement a loop that goes over the intersectio...

Implemented in commit c6d2e8f: clusters now grow across all override-area intersection lists, repeatedly extending the boundary from the latest hit plus epsilon_factor.

@wawanbreton

Copy link
Copy Markdown
Contributor

Proposed solution is still not complete, finishing it manually in the branch.

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