Skip to content

Fix broken trace behavior for non-closed paths - #511

Open
jeffc wants to merge 2 commits into
GridSpace:rel-nextfrom
jeffc:trace-fix
Open

Fix broken trace behavior for non-closed paths#511
jeffc wants to merge 2 commits into
GridSpace:rel-nextfrom
jeffc:trace-fix

Conversation

@jeffc

@jeffc jeffc commented Aug 29, 2026

Copy link
Copy Markdown

Fixes two bugs in trace operations for open paths:

  1. Allows length-2 open paths (ie, a single segment), which were previously filtered out
  2. Checks the direction ("winding order" equivalent) of open paths and corrects them if necessary. Open paths are generated by linking segments selected by the user, which could lead to arbitrary flipping of segment direction. By ensuring that the "right-handed" normal points out of the part, we ensure that "outside" offsets do indeed go out (and "inside" offsets go in).

I've attached an example workspace that traces a single segment on a part. In the current version of kiri:moto, no toolpaths are generated. If you apply the first commit in this PR, the toolpath gets generated inside the part even though "outside" is selected. When you apply both commits, it works as expected.

note: I discovered #510 while writing this, which is why .right got switched to .left in polygons.js. I figured I'd stick with the current convention rather than try to fix the whole thing as part of this PR.

workspace_key_offset_example.zip

jeffc added 2 commits August 28, 2026 20:24
…ations) and correct them if necessary

This ensure that "inside" and "outside" work as expected for open paths
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.

1 participant