parent
4f4b70de64
commit
e52d04e6ba
|
@ -1,7 +1,3 @@
|
||||||
The Clipper code library, the "Software" (that includes Delphi, C++ & C#
|
|
||||||
source code, accompanying samples and documentation), has been released
|
|
||||||
under the following license, terms and conditions:
|
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
http://www.boost.org/LICENSE_1_0.txt
|
http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
@ -25,5 +21,4 @@ FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
DEALINGS IN THE SOFTWARE.
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* *
|
* *
|
||||||
* Author : Angus Johnson *
|
* Author : Angus Johnson *
|
||||||
* Version : 4.8.8 *
|
* Version : 6.4.2 *
|
||||||
* Date : 30 August 2012 *
|
* Date : 27 February 2017 *
|
||||||
* Website : http://www.angusj.com *
|
* Website : http://www.angusj.com *
|
||||||
* Copyright : Angus Johnson 2010-2012 *
|
* Copyright : Angus Johnson 2010-2017 *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* Use, modification & distribution is subject to Boost Software License Ver 1. *
|
* Use, modification & distribution is subject to Boost Software License Ver 1. *
|
||||||
|
@ -34,11 +34,30 @@
|
||||||
#ifndef clipper_hpp
|
#ifndef clipper_hpp
|
||||||
#define clipper_hpp
|
#define clipper_hpp
|
||||||
|
|
||||||
|
#define CLIPPER_VERSION "6.4.2"
|
||||||
|
|
||||||
|
//use_int32: When enabled 32bit ints are used instead of 64bit ints. This
|
||||||
|
//improve performance but coordinate values are limited to the range +/- 46340
|
||||||
|
//#define use_int32
|
||||||
|
|
||||||
|
//use_xyz: adds a Z member to IntPoint. Adds a minor cost to perfomance.
|
||||||
|
//#define use_xyz
|
||||||
|
|
||||||
|
//use_lines: Enables line clipping. Adds a very minor cost to performance.
|
||||||
|
#define use_lines
|
||||||
|
|
||||||
|
//use_deprecated: Enables temporary support for the obsolete functions
|
||||||
|
//#define use_deprecated
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <functional>
|
||||||
|
#include <queue>
|
||||||
|
|
||||||
namespace ClipperLib {
|
namespace ClipperLib {
|
||||||
|
|
||||||
|
@ -50,129 +69,150 @@ enum PolyType { ptSubject, ptClip };
|
||||||
//see http://glprogramming.com/red/chapter11.html
|
//see http://glprogramming.com/red/chapter11.html
|
||||||
enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative };
|
enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative };
|
||||||
|
|
||||||
typedef signed long long long64;
|
#ifdef use_int32
|
||||||
typedef unsigned long long ulong64;
|
typedef int cInt;
|
||||||
|
static cInt const loRange = 0x7FFF;
|
||||||
|
static cInt const hiRange = 0x7FFF;
|
||||||
|
#else
|
||||||
|
typedef signed long long cInt;
|
||||||
|
static cInt const loRange = 0x3FFFFFFF;
|
||||||
|
static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL;
|
||||||
|
typedef signed long long long64; //used by Int128 class
|
||||||
|
typedef unsigned long long ulong64;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
struct IntPoint {
|
struct IntPoint {
|
||||||
|
cInt X;
|
||||||
|
cInt Y;
|
||||||
|
#ifdef use_xyz
|
||||||
|
cInt Z;
|
||||||
|
IntPoint(cInt x = 0, cInt y = 0, cInt z = 0): X(x), Y(y), Z(z) {};
|
||||||
|
#else
|
||||||
|
IntPoint(cInt x = 0, cInt y = 0): X(x), Y(y) {};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
friend inline bool operator== (const IntPoint& a, const IntPoint& b)
|
||||||
|
{
|
||||||
|
return a.X == b.X && a.Y == b.Y;
|
||||||
|
}
|
||||||
|
friend inline bool operator!= (const IntPoint& a, const IntPoint& b)
|
||||||
|
{
|
||||||
|
return a.X != b.X || a.Y != b.Y;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
typedef std::vector< IntPoint > Path;
|
||||||
|
typedef std::vector< Path > Paths;
|
||||||
|
|
||||||
|
inline Path& operator <<(Path& poly, const IntPoint& p) {poly.push_back(p); return poly;}
|
||||||
|
inline Paths& operator <<(Paths& polys, const Path& p) {polys.push_back(p); return polys;}
|
||||||
|
|
||||||
|
std::ostream& operator <<(std::ostream &s, const IntPoint &p);
|
||||||
|
std::ostream& operator <<(std::ostream &s, const Path &p);
|
||||||
|
std::ostream& operator <<(std::ostream &s, const Paths &p);
|
||||||
|
|
||||||
|
struct DoublePoint
|
||||||
|
{
|
||||||
|
double X;
|
||||||
|
double Y;
|
||||||
|
DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {}
|
||||||
|
DoublePoint(IntPoint ip) : X((double)ip.X), Y((double)ip.Y) {}
|
||||||
|
};
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef use_xyz
|
||||||
|
typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4};
|
||||||
|
enum JoinType {jtSquare, jtRound, jtMiter};
|
||||||
|
enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound};
|
||||||
|
|
||||||
|
class PolyNode;
|
||||||
|
typedef std::vector< PolyNode* > PolyNodes;
|
||||||
|
|
||||||
|
class PolyNode
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
long64 X;
|
PolyNode();
|
||||||
long64 Y;
|
virtual ~PolyNode(){};
|
||||||
IntPoint(long64 x = 0, long64 y = 0): X(x), Y(y) {};
|
Path Contour;
|
||||||
friend std::ostream& operator <<(std::ostream &s, IntPoint &p);
|
PolyNodes Childs;
|
||||||
|
PolyNode* Parent;
|
||||||
|
PolyNode* GetNext() const;
|
||||||
|
bool IsHole() const;
|
||||||
|
bool IsOpen() const;
|
||||||
|
int ChildCount() const;
|
||||||
|
private:
|
||||||
|
//PolyNode& operator =(PolyNode& other);
|
||||||
|
unsigned Index; //node index in Parent.Childs
|
||||||
|
bool m_IsOpen;
|
||||||
|
JoinType m_jointype;
|
||||||
|
EndType m_endtype;
|
||||||
|
PolyNode* GetNextSiblingUp() const;
|
||||||
|
void AddChild(PolyNode& child);
|
||||||
|
friend class Clipper; //to access Index
|
||||||
|
friend class ClipperOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector< IntPoint > Polygon;
|
class PolyTree: public PolyNode
|
||||||
typedef std::vector< Polygon > Polygons;
|
{
|
||||||
|
public:
|
||||||
std::ostream& operator <<(std::ostream &s, Polygon &p);
|
~PolyTree(){ Clear(); };
|
||||||
std::ostream& operator <<(std::ostream &s, Polygons &p);
|
PolyNode* GetFirst() const;
|
||||||
|
void Clear();
|
||||||
struct ExPolygon {
|
int Total() const;
|
||||||
Polygon outer;
|
private:
|
||||||
Polygons holes;
|
//PolyTree& operator =(PolyTree& other);
|
||||||
};
|
PolyNodes AllNodes;
|
||||||
typedef std::vector< ExPolygon > ExPolygons;
|
friend class Clipper; //to access AllNodes
|
||||||
|
|
||||||
enum JoinType { jtSquare, jtRound, jtMiter };
|
|
||||||
|
|
||||||
bool Orientation(const Polygon &poly);
|
|
||||||
double Area(const Polygon &poly);
|
|
||||||
void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys,
|
|
||||||
double delta, JoinType jointype = jtSquare, double MiterLimit = 2);
|
|
||||||
void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillType fillType = pftEvenOdd);
|
|
||||||
void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFillType fillType = pftEvenOdd);
|
|
||||||
void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd);
|
|
||||||
|
|
||||||
void ReversePolygon(Polygon& p);
|
|
||||||
void ReversePolygons(Polygons& p);
|
|
||||||
|
|
||||||
//used internally ...
|
|
||||||
enum EdgeSide { esNeither = 0, esLeft = 1, esRight = 2, esBoth = 3 };
|
|
||||||
enum IntersectProtects { ipNone = 0, ipLeft = 1, ipRight = 2, ipBoth = 3 };
|
|
||||||
|
|
||||||
struct TEdge {
|
|
||||||
long64 xbot;
|
|
||||||
long64 ybot;
|
|
||||||
long64 xcurr;
|
|
||||||
long64 ycurr;
|
|
||||||
long64 xtop;
|
|
||||||
long64 ytop;
|
|
||||||
double dx;
|
|
||||||
long64 tmpX;
|
|
||||||
PolyType polyType;
|
|
||||||
EdgeSide side;
|
|
||||||
int windDelta; //1 or -1 depending on winding direction
|
|
||||||
int windCnt;
|
|
||||||
int windCnt2; //winding count of the opposite polytype
|
|
||||||
int outIdx;
|
|
||||||
TEdge *next;
|
|
||||||
TEdge *prev;
|
|
||||||
TEdge *nextInLML;
|
|
||||||
TEdge *nextInAEL;
|
|
||||||
TEdge *prevInAEL;
|
|
||||||
TEdge *nextInSEL;
|
|
||||||
TEdge *prevInSEL;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IntersectNode {
|
bool Orientation(const Path &poly);
|
||||||
TEdge *edge1;
|
double Area(const Path &poly);
|
||||||
TEdge *edge2;
|
int PointInPolygon(const IntPoint &pt, const Path &path);
|
||||||
IntPoint pt;
|
|
||||||
IntersectNode *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct LocalMinima {
|
void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
|
||||||
long64 Y;
|
void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
|
||||||
TEdge *leftBound;
|
void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd);
|
||||||
TEdge *rightBound;
|
|
||||||
LocalMinima *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Scanbeam {
|
void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415);
|
||||||
long64 Y;
|
void CleanPolygon(Path& poly, double distance = 1.415);
|
||||||
Scanbeam *next;
|
void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415);
|
||||||
};
|
void CleanPolygons(Paths& polys, double distance = 1.415);
|
||||||
|
|
||||||
struct OutPt; //forward declaration
|
void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed);
|
||||||
|
void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed);
|
||||||
|
void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
|
||||||
|
|
||||||
struct OutRec {
|
void PolyTreeToPaths(const PolyTree& polytree, Paths& paths);
|
||||||
int idx;
|
void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths);
|
||||||
bool isHole;
|
void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
|
||||||
OutRec *FirstLeft;
|
|
||||||
OutRec *AppendLink;
|
|
||||||
OutPt *pts;
|
|
||||||
OutPt *bottomPt;
|
|
||||||
OutPt *bottomFlag;
|
|
||||||
EdgeSide sides;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct OutPt {
|
void ReversePath(Path& p);
|
||||||
int idx;
|
void ReversePaths(Paths& p);
|
||||||
IntPoint pt;
|
|
||||||
OutPt *next;
|
|
||||||
OutPt *prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct JoinRec {
|
struct IntRect { cInt left; cInt top; cInt right; cInt bottom; };
|
||||||
IntPoint pt1a;
|
|
||||||
IntPoint pt1b;
|
|
||||||
int poly1Idx;
|
|
||||||
IntPoint pt2a;
|
|
||||||
IntPoint pt2b;
|
|
||||||
int poly2Idx;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct HorzJoinRec {
|
//enums that are used internally ...
|
||||||
TEdge *edge;
|
enum EdgeSide { esLeft = 1, esRight = 2};
|
||||||
int savedIdx;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct IntRect { long64 left; long64 top; long64 right; long64 bottom; };
|
//forward declarations (for stuff used internally) ...
|
||||||
|
struct TEdge;
|
||||||
|
struct IntersectNode;
|
||||||
|
struct LocalMinimum;
|
||||||
|
struct OutPt;
|
||||||
|
struct OutRec;
|
||||||
|
struct Join;
|
||||||
|
|
||||||
typedef std::vector < OutRec* > PolyOutList;
|
typedef std::vector < OutRec* > PolyOutList;
|
||||||
typedef std::vector < TEdge* > EdgeList;
|
typedef std::vector < TEdge* > EdgeList;
|
||||||
typedef std::vector < JoinRec* > JoinList;
|
typedef std::vector < Join* > JoinList;
|
||||||
typedef std::vector < HorzJoinRec* > HorzJoinList;
|
typedef std::vector < IntersectNode* > IntersectList;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
//ClipperBase is the ancestor to the Clipper class. It should not be
|
//ClipperBase is the ancestor to the Clipper class. It should not be
|
||||||
//instantiated directly. This class simply abstracts the conversion of sets of
|
//instantiated directly. This class simply abstracts the conversion of sets of
|
||||||
|
@ -182,110 +222,170 @@ class ClipperBase
|
||||||
public:
|
public:
|
||||||
ClipperBase();
|
ClipperBase();
|
||||||
virtual ~ClipperBase();
|
virtual ~ClipperBase();
|
||||||
bool AddPolygon(const Polygon &pg, PolyType polyType);
|
virtual bool AddPath(const Path &pg, PolyType PolyTyp, bool Closed);
|
||||||
bool AddPolygons( const Polygons &ppg, PolyType polyType);
|
bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed);
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
IntRect GetBounds();
|
IntRect GetBounds();
|
||||||
|
bool PreserveCollinear() {return m_PreserveCollinear;};
|
||||||
|
void PreserveCollinear(bool value) {m_PreserveCollinear = value;};
|
||||||
protected:
|
protected:
|
||||||
void DisposeLocalMinimaList();
|
void DisposeLocalMinimaList();
|
||||||
TEdge* AddBoundsToLML(TEdge *e);
|
TEdge* AddBoundsToLML(TEdge *e, bool IsClosed);
|
||||||
void PopLocalMinima();
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
void InsertLocalMinima(LocalMinima *newLm);
|
TEdge* ProcessBound(TEdge* E, bool IsClockwise);
|
||||||
LocalMinima *m_CurrentLM;
|
void InsertScanbeam(const cInt Y);
|
||||||
LocalMinima *m_MinimaList;
|
bool PopScanbeam(cInt &Y);
|
||||||
|
bool LocalMinimaPending();
|
||||||
|
bool PopLocalMinima(cInt Y, const LocalMinimum *&locMin);
|
||||||
|
OutRec* CreateOutRec();
|
||||||
|
void DisposeAllOutRecs();
|
||||||
|
void DisposeOutRec(PolyOutList::size_type index);
|
||||||
|
void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2);
|
||||||
|
void DeleteFromAEL(TEdge *e);
|
||||||
|
void UpdateEdgeIntoAEL(TEdge *&e);
|
||||||
|
|
||||||
|
typedef std::vector<LocalMinimum> MinimaList;
|
||||||
|
MinimaList::iterator m_CurrentLM;
|
||||||
|
MinimaList m_MinimaList;
|
||||||
|
|
||||||
bool m_UseFullRange;
|
bool m_UseFullRange;
|
||||||
EdgeList m_edges;
|
EdgeList m_edges;
|
||||||
|
bool m_PreserveCollinear;
|
||||||
|
bool m_HasOpenPaths;
|
||||||
|
PolyOutList m_PolyOuts;
|
||||||
|
TEdge *m_ActiveEdges;
|
||||||
|
|
||||||
|
typedef std::priority_queue<cInt> ScanbeamList;
|
||||||
|
ScanbeamList m_Scanbeam;
|
||||||
};
|
};
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
class Clipper : public virtual ClipperBase
|
class Clipper : public virtual ClipperBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Clipper();
|
Clipper(int initOptions = 0);
|
||||||
~Clipper();
|
|
||||||
bool Execute(ClipType clipType,
|
bool Execute(ClipType clipType,
|
||||||
Polygons &solution,
|
Paths &solution,
|
||||||
PolyFillType subjFillType = pftEvenOdd,
|
PolyFillType fillType = pftEvenOdd);
|
||||||
PolyFillType clipFillType = pftEvenOdd);
|
|
||||||
bool Execute(ClipType clipType,
|
bool Execute(ClipType clipType,
|
||||||
ExPolygons &solution,
|
Paths &solution,
|
||||||
PolyFillType subjFillType = pftEvenOdd,
|
PolyFillType subjFillType,
|
||||||
PolyFillType clipFillType = pftEvenOdd);
|
PolyFillType clipFillType);
|
||||||
void Clear();
|
bool Execute(ClipType clipType,
|
||||||
bool ReverseSolution() {return m_ReverseOutput;};
|
PolyTree &polytree,
|
||||||
|
PolyFillType fillType = pftEvenOdd);
|
||||||
|
bool Execute(ClipType clipType,
|
||||||
|
PolyTree &polytree,
|
||||||
|
PolyFillType subjFillType,
|
||||||
|
PolyFillType clipFillType);
|
||||||
|
bool ReverseSolution() { return m_ReverseOutput; };
|
||||||
void ReverseSolution(bool value) {m_ReverseOutput = value;};
|
void ReverseSolution(bool value) {m_ReverseOutput = value;};
|
||||||
|
bool StrictlySimple() {return m_StrictSimple;};
|
||||||
|
void StrictlySimple(bool value) {m_StrictSimple = value;};
|
||||||
|
//set the callback function for z value filling on intersections (otherwise Z is 0)
|
||||||
|
#ifdef use_xyz
|
||||||
|
void ZFillFunction(ZFillCallback zFillFunc);
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
void Reset();
|
virtual bool ExecuteInternal();
|
||||||
virtual bool ExecuteInternal(bool fixHoleLinkages);
|
|
||||||
private:
|
private:
|
||||||
PolyOutList m_PolyOuts;
|
JoinList m_Joins;
|
||||||
JoinList m_Joins;
|
JoinList m_GhostJoins;
|
||||||
HorzJoinList m_HorizJoins;
|
IntersectList m_IntersectList;
|
||||||
ClipType m_ClipType;
|
ClipType m_ClipType;
|
||||||
Scanbeam *m_Scanbeam;
|
typedef std::list<cInt> MaximaList;
|
||||||
TEdge *m_ActiveEdges;
|
MaximaList m_Maxima;
|
||||||
TEdge *m_SortedEdges;
|
TEdge *m_SortedEdges;
|
||||||
IntersectNode *m_IntersectNodes;
|
bool m_ExecuteLocked;
|
||||||
bool m_ExecuteLocked;
|
PolyFillType m_ClipFillType;
|
||||||
PolyFillType m_ClipFillType;
|
PolyFillType m_SubjFillType;
|
||||||
PolyFillType m_SubjFillType;
|
bool m_ReverseOutput;
|
||||||
bool m_ReverseOutput;
|
bool m_UsingPolyTree;
|
||||||
void DisposeScanbeamList();
|
bool m_StrictSimple;
|
||||||
|
#ifdef use_xyz
|
||||||
|
ZFillCallback m_ZFill; //custom callback
|
||||||
|
#endif
|
||||||
void SetWindingCount(TEdge& edge);
|
void SetWindingCount(TEdge& edge);
|
||||||
bool IsEvenOddFillType(const TEdge& edge) const;
|
bool IsEvenOddFillType(const TEdge& edge) const;
|
||||||
bool IsEvenOddAltFillType(const TEdge& edge) const;
|
bool IsEvenOddAltFillType(const TEdge& edge) const;
|
||||||
void InsertScanbeam(const long64 Y);
|
void InsertLocalMinimaIntoAEL(const cInt botY);
|
||||||
long64 PopScanbeam();
|
void InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge);
|
||||||
void InsertLocalMinimaIntoAEL(const long64 botY);
|
|
||||||
void InsertEdgeIntoAEL(TEdge *edge);
|
|
||||||
void AddEdgeToSEL(TEdge *edge);
|
void AddEdgeToSEL(TEdge *edge);
|
||||||
|
bool PopEdgeFromSEL(TEdge *&edge);
|
||||||
void CopyAELToSEL();
|
void CopyAELToSEL();
|
||||||
void DeleteFromSEL(TEdge *e);
|
void DeleteFromSEL(TEdge *e);
|
||||||
void DeleteFromAEL(TEdge *e);
|
|
||||||
void UpdateEdgeIntoAEL(TEdge *&e);
|
|
||||||
void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2);
|
void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2);
|
||||||
bool IsContributing(const TEdge& edge) const;
|
bool IsContributing(const TEdge& edge) const;
|
||||||
bool IsTopHorz(const long64 XPos);
|
bool IsTopHorz(const cInt XPos);
|
||||||
void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2);
|
void DoMaxima(TEdge *e);
|
||||||
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);
|
OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
|
||||||
|
OutRec* GetOutRec(int idx);
|
||||||
void AppendPolygon(TEdge *e1, TEdge *e2);
|
void AppendPolygon(TEdge *e1, TEdge *e2);
|
||||||
void DoEdge1(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
|
void IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &pt);
|
||||||
void DoEdge2(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
|
OutPt* AddOutPt(TEdge *e, const IntPoint &pt);
|
||||||
void DoBothEdges(TEdge *edge1, TEdge *edge2, const IntPoint &pt);
|
OutPt* GetLastOutPt(TEdge *e);
|
||||||
void IntersectEdges(TEdge *e1, TEdge *e2,
|
bool ProcessIntersections(const cInt topY);
|
||||||
const IntPoint &pt, IntersectProtects protects);
|
void BuildIntersectList(const cInt topY);
|
||||||
OutRec* CreateOutRec();
|
|
||||||
void AddOutPt(TEdge *e, const IntPoint &pt);
|
|
||||||
void DisposeBottomPt(OutRec &outRec);
|
|
||||||
void DisposeAllPolyPts();
|
|
||||||
void DisposeOutRec(PolyOutList::size_type index);
|
|
||||||
bool ProcessIntersections(const long64 botY, const long64 topY);
|
|
||||||
void AddIntersectNode(TEdge *e1, TEdge *e2, const IntPoint &pt);
|
|
||||||
void BuildIntersectList(const long64 botY, const long64 topY);
|
|
||||||
void ProcessIntersectList();
|
void ProcessIntersectList();
|
||||||
void ProcessEdgesAtTopOfScanbeam(const long64 topY);
|
void ProcessEdgesAtTopOfScanbeam(const cInt topY);
|
||||||
void BuildResult(Polygons& polys);
|
void BuildResult(Paths& polys);
|
||||||
void BuildResultEx(ExPolygons& polys);
|
void BuildResult2(PolyTree& polytree);
|
||||||
void SetHoleState(TEdge *e, OutRec *OutRec);
|
void SetHoleState(TEdge *e, OutRec *outrec);
|
||||||
void DisposeIntersectNodes();
|
void DisposeIntersectNodes();
|
||||||
bool FixupIntersections();
|
bool FixupIntersectionOrder();
|
||||||
void FixupOutPolygon(OutRec &outRec);
|
void FixupOutPolygon(OutRec &outrec);
|
||||||
|
void FixupOutPolyline(OutRec &outrec);
|
||||||
bool IsHole(TEdge *e);
|
bool IsHole(TEdge *e);
|
||||||
void FixHoleLinkage(OutRec *outRec);
|
bool FindOwnerFromSplitRecs(OutRec &outRec, OutRec *&currOrfl);
|
||||||
void CheckHoleLinkages1(OutRec *outRec1, OutRec *outRec2);
|
void FixHoleLinkage(OutRec &outrec);
|
||||||
void CheckHoleLinkages2(OutRec *outRec1, OutRec *outRec2);
|
void AddJoin(OutPt *op1, OutPt *op2, const IntPoint offPt);
|
||||||
void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1);
|
|
||||||
void ClearJoins();
|
void ClearJoins();
|
||||||
void AddHorzJoin(TEdge *e, int idx);
|
void ClearGhostJoins();
|
||||||
void ClearHorzJoins();
|
void AddGhostJoin(OutPt *op, const IntPoint offPt);
|
||||||
void JoinCommonEdges(bool fixHoleLinkages);
|
bool JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2);
|
||||||
|
void JoinCommonEdges();
|
||||||
|
void DoSimplePolygons();
|
||||||
|
void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec);
|
||||||
|
void FixupFirstLefts2(OutRec* InnerOutRec, OutRec* OuterOutRec);
|
||||||
|
void FixupFirstLefts3(OutRec* OldOutRec, OutRec* NewOutRec);
|
||||||
|
#ifdef use_xyz
|
||||||
|
void SetZ(IntPoint& pt, TEdge& e1, TEdge& e2);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class ClipperOffset
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ClipperOffset(double miterLimit = 2.0, double roundPrecision = 0.25);
|
||||||
|
~ClipperOffset();
|
||||||
|
void AddPath(const Path& path, JoinType joinType, EndType endType);
|
||||||
|
void AddPaths(const Paths& paths, JoinType joinType, EndType endType);
|
||||||
|
void Execute(Paths& solution, double delta);
|
||||||
|
void Execute(PolyTree& solution, double delta);
|
||||||
|
void Clear();
|
||||||
|
double MiterLimit;
|
||||||
|
double ArcTolerance;
|
||||||
|
private:
|
||||||
|
Paths m_destPolys;
|
||||||
|
Path m_srcPoly;
|
||||||
|
Path m_destPoly;
|
||||||
|
std::vector<DoublePoint> m_normals;
|
||||||
|
double m_delta, m_sinA, m_sin, m_cos;
|
||||||
|
double m_miterLim, m_StepsPerRad;
|
||||||
|
IntPoint m_lowest;
|
||||||
|
PolyNode m_polyNodes;
|
||||||
|
|
||||||
|
void FixOrientations();
|
||||||
|
void DoOffset(double delta);
|
||||||
|
void OffsetPoint(int j, int& k, JoinType jointype);
|
||||||
|
void DoSquare(int j, int k);
|
||||||
|
void DoMiter(int j, int k, double r);
|
||||||
|
void DoRound(int j, int k);
|
||||||
|
};
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
class clipperException : public std::exception
|
class clipperException : public std::exception
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
---------------------
|
||||||
|
MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html )
|
||||||
|
|
||||||
|
When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0.
|
||||||
|
All possible work was done for compatibility.
|
||||||
|
|
||||||
|
|
||||||
|
Background
|
||||||
|
---------------------
|
||||||
|
When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64
|
||||||
|
support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ )
|
||||||
|
|
||||||
|
That was used as a starting point. And after that ZIP64 support was added to zip.c
|
||||||
|
some refactoring and code cleanup was also done.
|
||||||
|
|
||||||
|
|
||||||
|
Changed from MiniZip 1.0 to MiniZip 1.1
|
||||||
|
---------------------------------------
|
||||||
|
* Added ZIP64 support for unzip ( by Even Rouault )
|
||||||
|
* Added ZIP64 support for zip ( by Mathias Svensson )
|
||||||
|
* Reverted some changed that Even Rouault did.
|
||||||
|
* Bunch of patches received from Gulles Vollant that he received for MiniZip from various users.
|
||||||
|
* Added unzip patch for BZIP Compression method (patch create by Daniel Borca)
|
||||||
|
* Added BZIP Compress method for zip
|
||||||
|
* Did some refactoring and code cleanup
|
||||||
|
|
||||||
|
|
||||||
|
Credits
|
||||||
|
|
||||||
|
Gilles Vollant - Original MiniZip author
|
||||||
|
Even Rouault - ZIP64 unzip Support
|
||||||
|
Daniel Borca - BZip Compression method support in unzip
|
||||||
|
Mathias Svensson - ZIP64 zip support
|
||||||
|
Mathias Svensson - BZip Compression method support in zip
|
||||||
|
|
||||||
|
Resources
|
||||||
|
|
||||||
|
ZipLayout http://result42.com/projects/ZipFileLayout
|
||||||
|
Command line tool for Windows that shows the layout and information of the headers in a zip archive.
|
||||||
|
Used when debugging and validating the creation of zip files using MiniZip64
|
||||||
|
|
||||||
|
|
||||||
|
ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT
|
||||||
|
Zip File specification
|
||||||
|
|
||||||
|
|
||||||
|
Notes.
|
||||||
|
* To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined.
|
||||||
|
|
||||||
|
License
|
||||||
|
----------------------------------------------------------
|
||||||
|
Condition of use and distribution are the same than zlib :
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue