Commit graph

5 commits

Author SHA1 Message Date
Rodrigo Faselli
506fde8f86
Clipper 2 multiline Infill (#11435)
Some checks failed
Build all / Build Linux (push) Waiting to run
Build all / Build Non-Linux (push) Waiting to run
Build all / Unit Tests (push) Blocked by required conditions
Build all / Flatpak (push) Waiting to run
Shellcheck / Shellcheck (push) Has been cancelled
* Grid non-crossing for multiline

cleaning

Replaced negative offset logic with surface contraction to reduce overlap with perimeters.

center the infill

filltriangles

update triangles

preallocate memory

Update FillRectilinear.cpp

Update FillRectilinear.cpp

overlapp adjustment

Fix Crash

Update FillRectilinear.cpp

density tunning

density tunning

fine tunning

reserve polilines

Grid non-crossing for multiline

Co-Authored-By: Ian Bassi <12130714+ianalexis@users.noreply.github.com>
Co-Authored-By: discip <53649486+discip@users.noreply.github.com>

* Improve multiline fill offset and polyline closure

Changed offset type from jtRound to jtMiter in multiline_fill for better geometry. Updated polyline conversion to require at least 3 points and ensured polylines are closed if not already. Updated FillGyroid, FillTpmsD, and FillTpmsFK to pass the 'close' argument to multiline_fill.

cleaning

FillAdaptive Noncross

Only use clipper if worth it

safeguard

fix overlap

Update FillRectilinear.cpp

FilllRectilineal multiline clipper

Update FillRectilinear.cpp

FilllRectilineal multiline clipper

Update FillRectilinear.cpp

Update FillRectilinear.cpp

fix 3d honeycomb

Simplify polylines

Update FillBase.cpp

Update FillBase.cpp

cleaning

Improved Multiline Function

This ensures `multiline_fill()` will correctly generate multiline infill with
closed loop polylines if the input infill line is a closedloop polyline. This
ensures that the multiline infill doesn't have little gaps or overlaps at the
"closed point" of the original infill line.

This changes how the tangent is calculated for the first and last points in a
polyline if the first and last points are the same, making it a closed loop.
Instead of just using the first or last line segment, it uses the line segment
between the points before the last point and after the first point, the same
way that all the other poly-line mid points are handled.

It also uses eigen vector operations to calculate the points instead of
explicitly calculating the x and y values. This is probably faster, and if not
then it is at least more concise.

Hibrid Multiline Function

Update FillRectilinear.cpp

Update FillRectilinear.cpp

Update FillRectilinear.cpp

Update FillRectilinear.cpp

clipperutils multiline hibrido

Update FillBase.cpp

Update FillBase.cpp

Update FillBase.cpp

multiline hibrido

arc tolerance

multiline con union

Update FillBase.cpp

Update FillBase.cpp

Update FillBase.cpp

Co-Authored-By: Ian Bassi <12130714+ianalexis@users.noreply.github.com>
Co-Authored-By: Donovan Baarda <dbaarda@gmail.com>

* Switch multiline offset logic to Clipper2

Replaces Clipper-based multiline offset logic in FillBase.cpp with Clipper2, using InflatePaths and Union for offsetting and merging. Adds new conversion utilities in Clipper2Utils for handling Paths64 to Polygons/Polylines and updates headers accordingly.

* Refactor multiline_fill to always use Clipper2 logic

Removed the 'use_clipper' parameter from multiline_fill and updated all callers to use the new signature. The function now consistently applies Clipper2-based offset logic for multiline infill, simplifying the code and ensuring uniform behavior across fill patterns.

* Change offset join type to Round in multiline_fill

Replaces the Miter join type with Round in the InflatePaths call within multiline_fill. For smotther print travels.

* Increase max infill multiline to 10

Raised the maximum allowed value for the 'Fill Multiline' infill parameter from 5 to 10 to support more lines in infill patterns.

* Refactor multiline_fill to optimize offset logic

Replaces manual conversion of polylines to Clipper2 paths with Slic3rPolylines_to_Paths64 and filters short paths using std::remove_if. Uses ClipperOffset for path inflation and streamlines merging and conversion to polylines, improving performance and code clarity.

* half iteration because is bucle

* Funciona 1

Refactored the multiline_fill function to streamline the insertion of center lines by directly checking for odd line counts and removing redundant logic. This improves code clarity and reduces unnecessary checks.

* Refactor multiline_fill for improved offset logic

Reworked the multiline_fill function to simplify and clarify the logic for generating multiple offset lines. The new implementation computes offsets more explicitly for odd and even cases, creates a fresh ClipperOffset for each band, and improves conversion between Clipper2 paths and polylines. This enhances maintainability and correctness of the multiline fill generation.

* Quartercubic multiline

* fillplanePath

fix bounding box

Co-Authored-By: Ian Bassi <12130714+ianalexis@users.noreply.github.com>

* fillconcentric multiline

Co-Authored-By: Ian Bassi <12130714+ianalexis@users.noreply.github.com>

* Update FillBase.hpp

* cleaning

* Refactor multiline_fill to clean polylines and reuse offsetter

Invalid polylines with less than two points are now removed before processing. The ClipperOffset object is created once and reused for each offset, improving efficiency and code clarity.

trigger build

* Optimize Filltrapezoidal

Refactored the trapezoidal fill pattern generation to precompute base row templates and reuse them with vertical translation, reducing redundant computations and improving code clarity. This change enhances performance and maintainability by avoiding repeated construction of row patterns within loops.

* Replace push_back with emplace_back for Polyline points

Updated Polyline point insertion from push_back to emplace_back for efficiency and clarity. Also refactored row copying logic to avoid in-place modification, improving code readability and safety.

* Update FillRectilinear.cpp

* Reserve space for poliline points

* Union not needed

* Update FillRectilinear.cpp

* unused functions

* compactado

Update FillRectilinear.cpp

* Adjust minimum rows for better performance

* Update FillRectilinear.cpp

---------

Co-authored-by: Ian Bassi <12130714+ianalexis@users.noreply.github.com>
Co-authored-by: discip <53649486+discip@users.noreply.github.com>
Co-authored-by: Donovan Baarda <dbaarda@gmail.com>
Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
2025-12-23 22:53:09 +02:00
Ian Bassi
3367648ec0
Re-include BBS's Clipperutils2 (#11415)
* Clipper2 from BBS

* Fix

* Clipper2 Update: 1.5.2 -> 2.1.5.4

* Replace Clipper2Lib::Area calls with Clipper2LibArea

Updated area calculation calls to use Clipper2LibArea<T> instead of Clipper2Lib::Area<T> in multiple locations. This change likely reflects a refactor or renaming of the area calculation function.

* Revert "Replace Clipper2Lib::Area calls with Clipper2LibArea"

This reverts commit c92a9a1522e8d7b0f1f8557d4c752a8b8c8fc279.

* Revert "Clipper2 Update: 1.5.2 -> 2.1.5.4"

This reverts commit a745894bdc9cda4ce4d19e0705d214b78091acad.

* Update project version
2025-11-22 15:39:12 +08:00
Noisyfox
fe4a72ec94
Upgrade clipper & improve multi-thread performance (#7177)
Some checks are pending
Build all / Build All (push) Waiting to run
Build all / Flatpak (push) Waiting to run
* Clipper: Verify range of int32 coordinates on input.

Cherry-picked from prusa3d/PrusaSlicer@fa7debf49d

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* ClipperLib: Optimized PointInPolygon() to calculate cross products
 with int64s instead of doubles.

Cherry-picked from prusa3d/PrusaSlicer@9dca8403fe

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* Reworked the ClipperLib / Polygon types to use
the tbb::scallable_allocator to better scale on multiple threads.

Cherry-picked from prusa3d/PrusaSlicer@9cde96993e

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* use tbb::scallable_allocator for Polygons and ExPolygon::holes
to better scale on multiple threads

Cherry-picked from prusa3d/PrusaSlicer@b67ad6434d

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* Fixed compilation on GCC and CLang

Cherry-picked from prusa3d/PrusaSlicer@b3b44681a9

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* Remove clipper2 which is not used

* Removed shiny profiler from clipperlib

Cherry-picked from prusa3d/PrusaSlicer@7e77048593

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* ClipperLib: Further optimization of memory allocation using scalable_allocator.
ClipperLib: SimplifyPolygon() - changed default winding number to positive,
      added strictly_simple parameter.
ClipperUtlis simplify_polygons() - removed "remove_collinear" parameter

Cherry-picked from prusa3d/PrusaSlicer@a7e17df25f

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* ClipperLib: emplace_back() instead of push_back().

Cherry-picked from prusa3d/PrusaSlicer@2e150795b1

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* Fixed issue in a 32bit clipper, where IntersectPoint() checked for
the Y coordinate of the calculated intersection point for validity,
but the Y coordinate was already rounded to 32bits, thus an overflow
may have in rare cases masked invalidity of the result.

Cherry-picked from prusa3d/PrusaSlicer@b39c33414f

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* Fixed Vojtech's out of boundary assert in Clipper library.

Cherry-picked from prusa3d/PrusaSlicer@0a202dcff3

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>

* Update clipper to 6.4.2.

Cherry-picked from prusa3d/PrusaSlicer@b8b3cccb40

Co-authored-by: Lukáš Hejl <hejl.lukas@gmail.com>

* Try fix cmake opencv

---------

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>
Co-authored-by: Lukáš Hejl <hejl.lukas@gmail.com>
2025-06-18 17:50:44 +08:00
Noisyfox
f136f04cfd
Fix Linux build & some warnings (#6438)
* Fix linux deps debug build

* Use the same DL_CACHE for release build when building debug version of deps on Linux.
This prevents downloading the same source packages twice, and avoid downloading again after deleting the build dir.

* Fix debug build

* Fix warnings "loop variable creates a copy from type" and "loop variable binds to a temporary constructed from type"
2024-08-18 11:33:00 +08:00
salt.wei
e863d1054a ENH: add clipper2 for preparing
Add clipper2 code into repo

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: Ib98ea3085055db7d125a92879c46b54e39bdc6b1
(cherry picked from commit 7398e71236a300531a172163c71f15440c37bd5e)
2022-12-15 04:33:48 -05:00