diff --git a/libs/kimath/include/geometry/shape_poly_set.h b/libs/kimath/include/geometry/shape_poly_set.h index 4ec8d82de8..f8a7ce7a63 100644 --- a/libs/kimath/include/geometry/shape_poly_set.h +++ b/libs/kimath/include/geometry/shape_poly_set.h @@ -1397,7 +1397,7 @@ private: void importPaths( Clipper2Lib::Paths64& paths, const std::vector& aZValueBuffer, const std::vector& aArcBuffe ); - void importPolyPath( Clipper2Lib::PolyPath64* aPolyPath, + void importPolyPath( const std::unique_ptr& aPolyPath, const std::vector& aZValueBuffer, const std::vector& aArcBuffer ); diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp index 4c129b91c7..7fbc3474d7 100644 --- a/libs/kimath/src/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -1070,17 +1070,9 @@ void SHAPE_POLY_SET::inflate2( int aAmount, int aCircleSegCount, CORNER_STRATEGY c.ArcTolerance( std::abs( aAmount ) * coeff ); c.MiterLimit( miterLimit ); - c.MergeGroups( true ); - Paths64 solution = c.Execute( aAmount ); - // We get paths back but we need the tree to assign the holes to the correct - // outlines - Clipper64 c2; PolyTree64 tree; - c2.PreserveCollinear = false; - c2.ReverseSolution = false; - c2.AddSubject( solution ); - c2.Execute(ClipType::Union, FillRule::Positive, tree); + c.Execute( aAmount, tree ); importTree( tree, zValues, arcBuffer ); tree.Clear(); @@ -1120,7 +1112,7 @@ void SHAPE_POLY_SET::importTree( ClipperLib::PolyTree* tree, } -void SHAPE_POLY_SET::importPolyPath( Clipper2Lib::PolyPath64* aPolyPath, +void SHAPE_POLY_SET::importPolyPath( const std::unique_ptr& aPolyPath, const std::vector& aZValueBuffer, const std::vector& aArcBuffer ) { @@ -1130,11 +1122,11 @@ void SHAPE_POLY_SET::importPolyPath( Clipper2Lib::PolyPath64* aPolyPa paths.reserve( aPolyPath->Count() + 1 ); paths.emplace_back( aPolyPath->Polygon(), aZValueBuffer, aArcBuffer ); - for( Clipper2Lib::PolyPath64* child : *aPolyPath ) + for( const std::unique_ptr& child : *aPolyPath ) { paths.emplace_back( child->Polygon(), aZValueBuffer, aArcBuffer ); - for( Clipper2Lib::PolyPath64* grandchild : *child ) + for( const std::unique_ptr& grandchild : *child ) importPolyPath( grandchild, aZValueBuffer, aArcBuffer ); } @@ -1149,7 +1141,7 @@ void SHAPE_POLY_SET::importTree( Clipper2Lib::PolyTree64& tree, { m_polys.clear(); - for( Clipper2Lib::PolyPath64* n : tree ) + for( const std::unique_ptr& n : tree ) importPolyPath( n, aZValueBuffer, aArcBuffer ); } diff --git a/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.core.h b/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.core.h index 59ca9fd396..c8a63840f9 100644 --- a/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.core.h +++ b/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.core.h @@ -29,7 +29,7 @@ namespace Clipper2Lib public: explicit Clipper2Exception(const char* description) : m_descr(description) {} - virtual const char* what() const throw() { return m_descr.c_str(); } + virtual const char* what() const throw() override { return m_descr.c_str(); } private: std::string m_descr; }; diff --git a/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.h b/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.h index 009653c406..f66d9c4d51 100644 --- a/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.h +++ b/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.h @@ -197,7 +197,7 @@ namespace Clipper2Lib { return result; } - inline Paths64 RectClip(const Rect64& rect, + inline Paths64 ClipRect(const Rect64& rect, const Paths64& paths, bool convex_only = false) { if (rect.IsEmpty() || paths.empty()) return Paths64(); @@ -205,7 +205,7 @@ namespace Clipper2Lib { return rc.Execute(paths, convex_only); } - inline Paths64 RectClip(const Rect64& rect, + inline Paths64 ClipRect(const Rect64& rect, const Path64& path, bool convex_only = false) { if (rect.IsEmpty() || path.empty()) return Paths64(); @@ -213,7 +213,7 @@ namespace Clipper2Lib { return rc.Execute(Paths64{ path }, convex_only); } - inline PathsD RectClip(const RectD& rect, + inline PathsD ClipRect(const RectD& rect, const PathsD& paths, bool convex_only = false, int precision = 2) { if (rect.IsEmpty() || paths.empty()) return PathsD(); @@ -229,30 +229,30 @@ namespace Clipper2Lib { rc.Execute(pp, convex_only), 1 / scale, error_code); } - inline PathsD RectClip(const RectD& rect, + inline PathsD ClipRect(const RectD& rect, const PathD& path, bool convex_only = false, int precision = 2) { - return RectClip(rect, PathsD{ path }, convex_only, precision); + return ClipRect(rect, PathsD{ path }, convex_only, precision); } - inline Paths64 RectClipLines(const Rect64& rect, const Paths64& lines) + inline Paths64 ClipRectLines(const Rect64& rect, const Paths64& lines) { if (rect.IsEmpty() || lines.empty()) return Paths64(); class RectClipLines rcl(rect); return rcl.Execute(lines); } - inline Paths64 RectClipLines(const Rect64& rect, const Path64& line) + inline Paths64 ClipRectLines(const Rect64& rect, const Path64& line) { - return RectClipLines(rect, Paths64{ line }); + return ClipRectLines(rect, Paths64{ line }); } - inline PathsD RectClipLines(const RectD& rect, const PathD& line, int precision = 2) + inline PathsD ClipRectLines(const RectD& rect, const PathD& line, int precision = 2) { - return RectClip(rect, PathsD{ line }, precision); + return ClipRect(rect, PathsD{ line }, precision); } - inline PathsD RectClipLines(const RectD& rect, const PathsD& lines, int precision = 2) + inline PathsD ClipRectLines(const RectD& rect, const PathsD& lines, int precision = 2) { if (rect.IsEmpty() || lines.empty()) return PathsD(); int error_code = 0; diff --git a/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.offset.h b/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.offset.h index 455ed879d7..b111a8e98f 100644 --- a/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.offset.h +++ b/thirdparty/clipper2/Clipper2Lib/include/clipper2/clipper.offset.h @@ -36,8 +36,8 @@ private: bool is_reversed = false; JoinType join_type; EndType end_type; - Group(const Paths64& paths, JoinType join_type, EndType end_type) : - paths_in(paths), join_type(join_type), end_type(end_type) {} + Group(const Paths64& paths, JoinType _join_type, EndType _end_type) : + paths_in(paths), join_type(_join_type), end_type(_end_type) {} }; int error_code_ = 0;