20#ifndef LIBREPCB_CORE_CLIPPERHELPERS_H
21#define LIBREPCB_CORE_CLIPPERHELPERS_H
26#include "../geometry/path.h"
28#include <polyclipping/clipper.hpp>
56 const ClipperLib::Path& path);
58 const ClipperLib::Path& path);
60 const ClipperLib::Path& path);
61 static void unite(ClipperLib::Paths& paths,
62 ClipperLib::PolyFillType fillType);
63 static void unite(ClipperLib::Paths& subject,
const ClipperLib::Paths& clip,
64 ClipperLib::PolyFillType subjectFillType,
65 ClipperLib::PolyFillType clipFillType);
66 static std::unique_ptr<ClipperLib::PolyTree>
uniteToTree(
67 const ClipperLib::Paths& paths, ClipperLib::PolyFillType fillType);
68 static std::unique_ptr<ClipperLib::PolyTree>
uniteToTree(
69 const ClipperLib::Paths& paths,
const ClipperLib::Paths& clip,
70 ClipperLib::PolyFillType subjectFillType,
71 ClipperLib::PolyFillType clipFillType);
72 static void intersect(ClipperLib::Paths& subject,
73 const ClipperLib::Paths& clip,
74 ClipperLib::PolyFillType subjectFillType,
75 ClipperLib::PolyFillType clipFillType);
77 const ClipperLib::Paths& subject,
const ClipperLib::Paths& clip,
78 ClipperLib::PolyFillType subjectFillType,
79 ClipperLib::PolyFillType clipFillType,
bool closed =
true);
81 const QList<ClipperLib::Paths>& paths);
82 static void subtract(ClipperLib::Paths& subject,
83 const ClipperLib::Paths& clip,
84 ClipperLib::PolyFillType subjectFillType,
85 ClipperLib::PolyFillType clipFillType);
87 const ClipperLib::Paths& subject,
const ClipperLib::Paths& clip,
88 ClipperLib::PolyFillType subjectFillType,
89 ClipperLib::PolyFillType clipFillType,
bool closed =
true);
92 ClipperLib::JoinType joinType = ClipperLib::jtRound);
93 static std::unique_ptr<ClipperLib::PolyTree>
offsetToTree(
96 static ClipperLib::Paths
treeToPaths(
const ClipperLib::PolyTree& tree);
97 static ClipperLib::Paths
flattenTree(
const ClipperLib::PolyNode& node);
100 static QVector<Path>
convert(
const ClipperLib::Paths& paths)
noexcept;
101 static Path convert(
const ClipperLib::Path& path)
noexcept;
102 static Point convert(
const ClipperLib::IntPoint& point)
noexcept;
103 static ClipperLib::Paths
convert(
104 const QVector<Path>& paths,
106 static ClipperLib::Path
convert(
108 static ClipperLib::IntPoint
convert(
const Point& point)
noexcept;
112 const ClipperLib::Paths& holes);
114 const ClipperLib::Paths& holes)
noexcept;
116 const ClipperLib::Path& hole)
noexcept;
118 const ClipperLib::Path& hole);
120 const ClipperLib::IntPoint& p);
122 const ClipperLib::IntPoint& p2,
123 const ClipperLib::cInt& x,
124 ClipperLib::cInt& y)
noexcept;
The ClipperHelpers class.
Definition clipperhelpers.h:46
static ClipperLib::Paths prepareHoles(const ClipperLib::Paths &holes) noexcept
Definition clipperhelpers.cpp:389
static bool allPointsInside(const ClipperLib::Path &points, const ClipperLib::Path &path)
Definition clipperhelpers.cpp:36
static ClipperLib::Paths treeToPaths(const ClipperLib::PolyTree &tree)
Definition clipperhelpers.cpp:281
static bool anyPointsInside(const ClipperLib::Path &points, const ClipperLib::Path &path)
Definition clipperhelpers.cpp:52
static void subtract(ClipperLib::Paths &subject, const ClipperLib::Paths &clip, ClipperLib::PolyFillType subjectFillType, ClipperLib::PolyFillType clipFillType)
Definition clipperhelpers.cpp:217
static ClipperLib::Path convertHolesToCutIns(const ClipperLib::Path &outline, const ClipperLib::Paths &holes)
Definition clipperhelpers.cpp:373
static void intersect(ClipperLib::Paths &subject, const ClipperLib::Paths &clip, ClipperLib::PolyFillType subjectFillType, ClipperLib::PolyFillType clipFillType)
Definition clipperhelpers.cpp:148
static std::unique_ptr< ClipperLib::PolyTree > subtractToTree(const ClipperLib::Paths &subject, const ClipperLib::Paths &clip, ClipperLib::PolyFillType subjectFillType, ClipperLib::PolyFillType clipFillType, bool closed=true)
Definition clipperhelpers.cpp:232
static QVector< Path > convert(const ClipperLib::Paths &paths) noexcept
Definition clipperhelpers.cpp:318
static std::unique_ptr< ClipperLib::PolyTree > uniteToTree(const ClipperLib::Paths &paths, ClipperLib::PolyFillType fillType)
Definition clipperhelpers.cpp:113
static std::unique_ptr< ClipperLib::PolyTree > intersectToTree(const ClipperLib::Paths &subject, const ClipperLib::Paths &clip, ClipperLib::PolyFillType subjectFillType, ClipperLib::PolyFillType clipFillType, bool closed=true)
Definition clipperhelpers.cpp:164
static int insertConnectionPointToPath(ClipperLib::Path &path, const ClipperLib::IntPoint &p)
Definition clipperhelpers.cpp:430
static ClipperLib::Paths flattenTree(const ClipperLib::PolyNode &node)
Definition clipperhelpers.cpp:294
static void unite(ClipperLib::Paths &paths, ClipperLib::PolyFillType fillType)
Definition clipperhelpers.cpp:86
static void addCutInToPath(ClipperLib::Path &outline, const ClipperLib::Path &hole)
Definition clipperhelpers.cpp:424
static void offset(ClipperLib::Paths &paths, const Length &offset, const PositiveLength &maxArcTolerance, ClipperLib::JoinType joinType=ClipperLib::jtRound)
Definition clipperhelpers.cpp:251
static std::unique_ptr< ClipperLib::PolyTree > offsetToTree(const ClipperLib::Paths &paths, const Length &offset, const PositiveLength &maxArcTolerance)
Definition clipperhelpers.cpp:264
static ClipperLib::Path rotateCutInHole(const ClipperLib::Path &hole) noexcept
Definition clipperhelpers.cpp:409
static bool calcIntersectionPos(const ClipperLib::IntPoint &p1, const ClipperLib::IntPoint &p2, const ClipperLib::cInt &x, ClipperLib::cInt &y) noexcept
Definition clipperhelpers.cpp:457
The Length class is used to represent a length (for example 12.75 millimeters)
Definition length.h:82
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition path.h:57
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
Definition occmodel.cpp:76
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810