Major improvement multiline offset function (several bugs, and dual aproach with clipperutils) #1905

Closed
opened 2026-04-05 21:03:50 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @RF47 on 10/16/2025

Description

Improved Multiline Fill Function

This PR enhances the multiline fill function to address several issues from the previous version, while implementing a hybrid approach using ClipperLib for specific use cases.
This improvement resolves all problems with intersections between infill lines. It is very similar to Cura's behavior. It may be a little slower, but it prevents collisions and is safer. It can prevent layer shift problems when using multiline.

Key Improvements:

  1. More precise offset for sharp corners using bisectrix calculation (prevents offset squashing at vertices)
  2. Detection and handling of closed loops inspired by @dbaarda implementation in #10876
  3. Single segment offset now is correct
  4. Hybrid offset strategy with both mathematical and Clipper-based approaches
  5. Solved Intersection for all rectilinear infills (for triangles and grid see (#11017) )

Why Not Always Use ClipperLib?

ClipperLib is extremely computationally expensive. I reserve exclusively for some infills where it delivers exceptional results that justify the performance cost. For standard infills, mathematical approach is much faster.

Tests

image image image

Before:
image
image

image

After:
image
image

image

close #3731

*Originally created by @RF47 on 10/16/2025* # Description ## Improved Multiline Fill Function This PR enhances the multiline fill function to address several issues from the previous version, while implementing a hybrid approach using ClipperLib for specific use cases. This improvement resolves all problems with intersections between infill lines. It is very similar to Cura's behavior. It may be a little slower, but it prevents collisions and is safer. It can prevent layer shift problems when using multiline. ### Key Improvements: 1. More precise offset for sharp corners using bisectrix calculation (prevents offset squashing at vertices) 2. Detection and handling of closed loops inspired by @dbaarda implementation in #10876 3. Single segment offset now is correct 4. Hybrid offset strategy with both mathematical and Clipper-based approaches 5. Solved Intersection for all rectilinear infills (for triangles and grid see (#11017) ) ### Why Not Always Use ClipperLib? ClipperLib is extremely computationally expensive. I reserve exclusively for some infills where it delivers exceptional results that justify the performance cost. For standard infills, mathematical approach is much faster. # Tests <img width="2073" height="1088" alt="image" src="https://github.com/user-attachments/assets/dee0c73e-56fa-4871-9bb1-e8b74dd98e13" /> <img width="1724" height="774" alt="image" src="https://github.com/user-attachments/assets/bc24926e-714c-46d1-b3c4-507484d8c550" /> <img width="1826" height="845" alt="image" src="https://github.com/user-attachments/assets/dd1e820f-94b4-48ce-8485-89049c6c758b" /> Before: <img width="851" height="678" alt="image" src="https://github.com/user-attachments/assets/2e879450-71e8-4d5b-8541-0344ad9f16ac" /> <img width="1364" height="1006" alt="image" src="https://github.com/user-attachments/assets/517fae07-ce78-4c08-811c-18259fb5ad21" /> <img width="1109" height="899" alt="image" src="https://github.com/user-attachments/assets/77da6511-85f7-4318-8fff-20506004cdfd" /> After: <img width="1142" height="1017" alt="image" src="https://github.com/user-attachments/assets/9f674ed6-9b52-4753-96f3-af5836181266" /> <img width="1329" height="1017" alt="image" src="https://github.com/user-attachments/assets/f786d023-ed47-48c7-94c4-a498853b05ac" /> <img width="1107" height="853" alt="image" src="https://github.com/user-attachments/assets/e767f1f8-b5dc-4ba8-87ea-4874ec37e984" /> close #3731
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#1905