34 #define CLIPPER_VERSION "6.4.2"
71 static cInt const loRange = 0x7FFF;
72 static cInt const hiRange = 0x7FFF;
74 typedef signed long long cInt;
75 static cInt const loRange = 0x3FFFFFFF;
76 static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL;
93 return a.
X == b.
X && a.
Y == b.
Y;
96 return a.
X != b.
X || a.
Y != b.
Y;
101 typedef std::vector<IntPoint>
Path;
126 typedef void (*ZFillCallback)(IntPoint &e1bot, IntPoint &e1top, IntPoint &e2bot,
127 IntPoint &e2top, IntPoint &pt);
197 double distance = 1.415);
225 struct IntersectNode;
302 void ZFillFunction(ZFillCallback zFillFunc);
312 typedef std::list<cInt> MaximaList;
314 TEdge *m_SortedEdges;
315 bool m_ExecuteLocked;
318 bool m_ReverseOutput;
319 bool m_UsingPolyTree;
322 ZFillCallback m_ZFill;
324 void SetWindingCount(TEdge &edge);
325 bool IsEvenOddFillType(
const TEdge &edge)
const;
326 bool IsEvenOddAltFillType(
const TEdge &edge)
const;
327 void InsertLocalMinimaIntoAEL(
const cInt botY);
328 void InsertEdgeIntoAEL(TEdge *edge, TEdge *startEdge);
329 void AddEdgeToSEL(TEdge *edge);
330 bool PopEdgeFromSEL(TEdge *&edge);
332 void DeleteFromSEL(TEdge *e);
333 void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2);
334 bool IsContributing(
const TEdge &edge)
const;
335 bool IsTopHorz(
const cInt XPos);
336 void DoMaxima(TEdge *e);
337 void ProcessHorizontals();
338 void ProcessHorizontal(TEdge *horzEdge);
339 void AddLocalMaxPoly(TEdge *e1, TEdge *e2,
const IntPoint &pt);
340 OutPt *AddLocalMinPoly(TEdge *e1, TEdge *e2,
const IntPoint &pt);
341 OutRec *GetOutRec(
int idx);
342 void AppendPolygon(TEdge *e1, TEdge *e2);
343 void IntersectEdges(TEdge *e1, TEdge *e2,
IntPoint &pt);
344 OutPt *AddOutPt(TEdge *e,
const IntPoint &pt);
345 OutPt *GetLastOutPt(TEdge *e);
346 bool ProcessIntersections(
const cInt topY);
347 void BuildIntersectList(
const cInt topY);
348 void ProcessIntersectList();
349 void ProcessEdgesAtTopOfScanbeam(
const cInt topY);
350 void BuildResult(
Paths &polys);
351 void BuildResult2(
PolyTree &polytree);
352 void SetHoleState(TEdge *e, OutRec *outrec);
353 void DisposeIntersectNodes();
354 bool FixupIntersectionOrder();
355 void FixupOutPolygon(OutRec &outrec);
356 void FixupOutPolyline(OutRec &outrec);
357 bool IsHole(TEdge *e);
358 bool FindOwnerFromSplitRecs(OutRec &outRec, OutRec *&currOrfl);
359 void FixHoleLinkage(OutRec &outrec);
360 void AddJoin(OutPt *op1, OutPt *op2,
const IntPoint offPt);
362 void ClearGhostJoins();
363 void AddGhostJoin(OutPt *op,
const IntPoint offPt);
364 bool JoinPoints(Join *j, OutRec *outRec1, OutRec *outRec2);
365 void JoinCommonEdges();
366 void DoSimplePolygons();
367 void FixupFirstLefts1(OutRec *OldOutRec, OutRec *NewOutRec);
368 void FixupFirstLefts2(OutRec *InnerOutRec, OutRec *OuterOutRec);
369 void FixupFirstLefts3(OutRec *OldOutRec, OutRec *NewOutRec);
371 void SetZ(
IntPoint &pt, TEdge &e1, TEdge &e2);
392 std::vector<DoublePoint> m_normals;
393 double m_delta, m_sinA, m_sin, m_cos;
394 double m_miterLim, m_StepsPerRad;
398 void FixOrientations();
399 void DoOffset(
double delta);
400 void OffsetPoint(
int j,
int &k,
JoinType jointype);
401 void DoSquare(
int j,
int k);
402 void DoMiter(
int j,
int k,
double r);
403 void DoRound(
int j,
int k);
411 virtual const char *
what()
const throw() {
return m_descr.c_str(); }
bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed)
TEdge * ProcessBound(TEdge *E, bool IsClockwise)
void DisposeLocalMinimaList()
void UpdateEdgeIntoAEL(TEdge *&e)
std::priority_queue< cInt > ScanbeamList
virtual bool AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
TEdge * AddBoundsToLML(TEdge *e, bool IsClosed)
void DeleteFromAEL(TEdge *e)
void PreserveCollinear(bool value)
void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2)
MinimaList::iterator m_CurrentLM
void InsertScanbeam(const cInt Y)
bool PopScanbeam(cInt &Y)
std::vector< LocalMinimum > MinimaList
bool LocalMinimaPending()
void DisposeOutRec(PolyOutList::size_type index)
bool PopLocalMinima(cInt Y, const LocalMinimum *&locMin)
void AddPath(const Path &path, JoinType joinType, EndType endType)
void AddPaths(const Paths &paths, JoinType joinType, EndType endType)
void Execute(PolyTree &solution, double delta)
ClipperOffset(double miterLimit=2.0, double roundPrecision=0.25)
void Execute(Paths &solution, double delta)
virtual bool ExecuteInternal()
bool Execute(ClipType clipType, Paths &solution, PolyFillType fillType=pftEvenOdd)
bool Execute(ClipType clipType, Paths &solution, PolyFillType subjFillType, PolyFillType clipFillType)
void ReverseSolution(bool value)
bool Execute(ClipType clipType, PolyTree &polytree, PolyFillType subjFillType, PolyFillType clipFillType)
void StrictlySimple(bool value)
bool Execute(ClipType clipType, PolyTree &polytree, PolyFillType fillType=pftEvenOdd)
Clipper(int initOptions=0)
PolyNode * GetNext() const
PolyNode * GetFirst() const
virtual const char * what() const
clipperException(const char *description)
virtual ~clipperException()
unsigned long long ulong64
std::vector< IntPoint > Path
void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType=pftEvenOdd)
void PolyTreeToPaths(const PolyTree &polytree, Paths &paths)
std::vector< Path > Paths
double Area(const Path &poly)
void CleanPolygons(const Paths &in_polys, Paths &out_polys, double distance=1.415)
std::vector< PolyNode * > PolyNodes
void MinkowskiDiff(const Path &poly1, const Path &poly2, Paths &solution)
Path & operator<<(Path &poly, const IntPoint &p)
bool Orientation(const Path &poly)
void ClosedPathsFromPolyTree(const PolyTree &polytree, Paths &paths)
std::vector< TEdge * > EdgeList
void OpenPathsFromPolyTree(PolyTree &polytree, Paths &paths)
void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType=pftEvenOdd)
std::vector< OutRec * > PolyOutList
void ReversePath(Path &p)
int PointInPolygon(const IntPoint &pt, const Path &path)
void MinkowskiSum(const Path &pattern, const Path &path, Paths &solution, bool pathIsClosed)
void ReversePaths(Paths &p)
std::vector< IntersectNode * > IntersectList
void CleanPolygon(const Path &in_poly, Path &out_poly, double distance=1.415)
std::vector< Join * > JoinList
DoublePoint(double x=0, double y=0)
friend bool operator==(const IntPoint &a, const IntPoint &b)
IntPoint(cInt x=0, cInt y=0)
friend bool operator!=(const IntPoint &a, const IntPoint &b)