clipper.hpp | clipper.hpp | |||
---|---|---|---|---|
/************************************************************************** ***** | /************************************************************************** ***** | |||
* * | * * | |||
* Author : Angus Johnson * | * Author : Angus Johnson * | |||
* Version : 4.9.4 | * Version : 4.9.6 | |||
* | * | |||
* Date : 2 November 2012 | * Date : 9 November 2012 | |||
* | * | |||
* Website : http://www.angusj.com * | * Website : http://www.angusj.com * | |||
* Copyright : Angus Johnson 2010-2012 * | * Copyright : Angus Johnson 2010-2012 * | |||
* * | * * | |||
* License: * | * License: * | |||
* Use, modification & distribution is subject to Boost Software License Ver 1. * | * Use, modification & distribution is subject to Boost Software License Ver 1. * | |||
* http://www.boost.org/LICENSE_1_0.txt * | * http://www.boost.org/LICENSE_1_0.txt * | |||
* * | * * | |||
* Attributions: * | * Attributions: * | |||
* The code in this library is an extension of Bala Vatti's clipping algorit hm: * | * The code in this library is an extension of Bala Vatti's clipping algorit hm: * | |||
* "A generic solution to polygon clipping" * | * "A generic solution to polygon clipping" * | |||
skipping to change at line 81 | skipping to change at line 81 | |||
Polygon outer; | Polygon outer; | |||
Polygons holes; | Polygons holes; | |||
}; | }; | |||
typedef std::vector< ExPolygon > ExPolygons; | typedef std::vector< ExPolygon > ExPolygons; | |||
enum JoinType { jtSquare, jtRound, jtMiter }; | enum JoinType { jtSquare, jtRound, jtMiter }; | |||
bool Orientation(const Polygon &poly); | bool Orientation(const Polygon &poly); | |||
double Area(const Polygon &poly); | double Area(const Polygon &poly); | |||
void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys, | void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys, | |||
double delta, JoinType jointype = jtSquare, double MiterLimit = 2); | double delta, JoinType jointype = jtSquare, double MiterLimit = 2, bool C heckInputs = true); | |||
void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillT ype fillType = pftEvenOdd); | void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillT ype fillType = pftEvenOdd); | |||
void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFi llType fillType = pftEvenOdd); | void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFi llType fillType = pftEvenOdd); | |||
void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd); | void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd); | |||
void ReversePolygon(Polygon& p); | void ReversePolygon(Polygon& p); | |||
void ReversePolygons(Polygons& p); | void ReversePolygons(Polygons& p); | |||
//used internally ... | //used internally ... | |||
enum EdgeSide { esNeither = 0, esLeft = 1, esRight = 2, esBoth = 3 }; | enum EdgeSide { esNeither = 0, esLeft = 1, esRight = 2, esBoth = 3 }; | |||
enum IntersectProtects { ipNone = 0, ipLeft = 1, ipRight = 2, ipBoth = 3 }; | enum IntersectProtects { ipNone = 0, ipLeft = 1, ipRight = 2, ipBoth = 3 }; | |||
skipping to change at line 262 | skipping to change at line 262 | |||
void DoMaxima(TEdge *e, long64 topY); | void DoMaxima(TEdge *e, long64 topY); | |||
void ProcessHorizontals(); | void ProcessHorizontals(); | |||
void ProcessHorizontal(TEdge *horzEdge); | void ProcessHorizontal(TEdge *horzEdge); | |||
void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); | void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); | |||
void AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); | void AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); | |||
void AppendPolygon(TEdge *e1, TEdge *e2); | void AppendPolygon(TEdge *e1, TEdge *e2); | |||
void DoEdge1(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | void DoEdge1(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | |||
void DoEdge2(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | void DoEdge2(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | |||
void DoBothEdges(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | void DoBothEdges(TEdge *edge1, TEdge *edge2, const IntPoint &pt); | |||
void IntersectEdges(TEdge *e1, TEdge *e2, | void IntersectEdges(TEdge *e1, TEdge *e2, | |||
const IntPoint &pt, IntersectProtects protects); | const IntPoint &pt, const IntersectProtects protects); | |||
OutRec* CreateOutRec(); | OutRec* CreateOutRec(); | |||
void AddOutPt(TEdge *e, const IntPoint &pt); | void AddOutPt(TEdge *e, const IntPoint &pt); | |||
void DisposeBottomPt(OutRec &outRec); | void DisposeBottomPt(OutRec &outRec); | |||
void DisposeAllPolyPts(); | void DisposeAllPolyPts(); | |||
void DisposeOutRec(PolyOutList::size_type index); | void DisposeOutRec(PolyOutList::size_type index); | |||
bool ProcessIntersections(const long64 botY, const long64 topY); | bool ProcessIntersections(const long64 botY, const long64 topY); | |||
void AddIntersectNode(TEdge *e1, TEdge *e2, const IntPoint &pt); | void AddIntersectNode(TEdge *e1, TEdge *e2, const IntPoint &pt); | |||
void BuildIntersectList(const long64 botY, const long64 topY); | void BuildIntersectList(const long64 botY, const long64 topY); | |||
void ProcessIntersectList(); | void ProcessIntersectList(); | |||
void ProcessEdgesAtTopOfScanbeam(const long64 topY); | void ProcessEdgesAtTopOfScanbeam(const long64 topY); | |||
skipping to change at line 285 | skipping to change at line 285 | |||
void SetHoleState(TEdge *e, OutRec *OutRec); | void SetHoleState(TEdge *e, OutRec *OutRec); | |||
void DisposeIntersectNodes(); | void DisposeIntersectNodes(); | |||
bool FixupIntersections(); | bool FixupIntersections(); | |||
void FixupOutPolygon(OutRec &outRec); | void FixupOutPolygon(OutRec &outRec); | |||
bool IsHole(TEdge *e); | bool IsHole(TEdge *e); | |||
void FixHoleLinkage(OutRec *outRec); | void FixHoleLinkage(OutRec *outRec); | |||
void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1); | void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1); | |||
void ClearJoins(); | void ClearJoins(); | |||
void AddHorzJoin(TEdge *e, int idx); | void AddHorzJoin(TEdge *e, int idx); | |||
void ClearHorzJoins(); | void ClearHorzJoins(); | |||
bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2); | ||||
void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx); | ||||
void JoinCommonEdges(bool fixHoleLinkages); | void JoinCommonEdges(bool fixHoleLinkages); | |||
}; | }; | |||
//------------------------------------------------------------------------- ----- | //------------------------------------------------------------------------- ----- | |||
//------------------------------------------------------------------------- ----- | //------------------------------------------------------------------------- ----- | |||
class clipperException : public std::exception | class clipperException : public std::exception | |||
{ | { | |||
public: | public: | |||
clipperException(const char* description): m_descr(description) {} | clipperException(const char* description): m_descr(description) {} | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 8 lines changed or added | |||