Skip to content

fix: correct partition_mask edge clipping (#1754)#1966

Open
junhinhow wants to merge 1 commit intoBelfrySCAD:masterfrom
junhinhow:fix/partition-clipping-1754
Open

fix: correct partition_mask edge clipping (#1754)#1966
junhinhow wants to merge 1 commit intoBelfrySCAD:masterfrom
junhinhow:fix/partition-clipping-1754

Conversation

@junhinhow
Copy link
Copy Markdown

Summary

  • Fix _partition_cutpath() edge clipping that produced partial/truncated cut patterns at boundaries
  • Replace ceil() with floor() for repetition count to ensure patterns fit within available space
  • Fix cplen formula: reps*cutsize.x + (reps-1)*gap (was incorrectly (cutsize.x+gap)*reps)
  • Remove truncation band-aid (stidxs/enidxs logic) since patterns now fit correctly
  • Reduce reps (instead of increase) when cutpath_centered with even count

Test plan

  • partition_mask with exact-fit length renders correctly
  • partition_mask with non-divisible length (l=47, cutsize=10) renders cleanly
  • partition_mask with gap parameter works
  • partition_cut_mask renders correctly
  • partition() module works end-to-end

🤖 Generated with Claude Code

The _partition_cutpath() function used ceil() to calculate repetitions,
producing patterns larger than available space and then truncating with
index logic (stidxs/enidxs), causing visual artifacts at the edges.

Fixes:
- Use floor() to ensure repetitions fit within available space
- Reduce reps (instead of increasing) when cutpath_centered with even count
- Calculate cplen correctly: reps*cutsize.x + (reps-1)*gap
- Remove truncation logic (stidxs/enidxs) that was a band-aid
- Limit right edge to cplen/2 instead of l/2

Fix based on analysis from the issue author.
@junhinhow junhinhow force-pushed the fix/partition-clipping-1754 branch from eeb75c3 to 16a9654 Compare April 6, 2026 13:48
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