ClipperLib Namespace Reference

Classes

class  Clipper
 
class  ClipperBase
 
class  clipperException
 
class  ClipperOffset
 
struct  DoublePoint
 
class  Int128
 
struct  IntersectNode
 
struct  IntPoint
 
struct  IntRect
 
struct  Join
 
struct  LocalMinimum
 
struct  LocMinSorter
 
struct  OutPt
 
struct  OutRec
 
class  PolyNode
 
class  PolyTree
 
struct  TEdge
 

Typedefs

typedef signed long long cInt
 
typedef std::vector< TEdge * > EdgeList
 
typedef std::vector< IntersectNode * > IntersectList
 
typedef std::vector< Join * > JoinList
 
typedef signed long long long64
 
typedef std::vector< IntPointPath
 
typedef std::vector< PathPaths
 
typedef std::vector< PolyNode * > PolyNodes
 
typedef std::vector< OutRec * > PolyOutList
 
typedef unsigned long long ulong64
 

Enumerations

enum  ClipType { ctIntersection, ctUnion, ctDifference, ctXor }
 
enum  Direction { dRightToLeft, dLeftToRight }
 
enum  EdgeSide { esLeft = 1, esRight = 2 }
 
enum  EndType {
  etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare,
  etOpenRound
}
 
enum  InitOptions { ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4 }
 
enum  JoinType { jtSquare, jtRound, jtMiter }
 
enum  NodeType { ntAny, ntOpen, ntClosed }
 
enum  PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative }
 
enum  PolyType { ptSubject, ptClip }
 

Functions

cInt Abs (cInt val)
 
void AddPolyNodeToPaths (const PolyNode &polynode, NodeType nodetype, Paths &paths)
 
double Area (const OutRec &outRec)
 
double Area (const Path &poly)
 
void CleanPolygon (const Path &in_poly, Path &out_poly, double distance)
 
void CleanPolygon (Path &poly, double distance)
 
void CleanPolygons (const Paths &in_polys, Paths &out_polys, double distance)
 
void CleanPolygons (Paths &polys, double distance)
 
void ClosedPathsFromPolyTree (const PolyTree &polytree, Paths &paths)
 
void DisposeOutPts (OutPt *&pp)
 
double DistanceFromLineSqrd (const IntPoint &pt, const IntPoint &ln1, const IntPoint &ln2)
 
double DistanceSqrd (const IntPoint &pt1, const IntPoint &pt2)
 
OutPtDupOutPt (OutPt *outPt, bool InsertAfter)
 
bool E2InsertsBeforeE1 (TEdge &e1, TEdge &e2)
 
bool EdgesAdjacent (const IntersectNode &inode)
 
OutPtExcludeOp (OutPt *op)
 
TEdgeFindNextLocMin (TEdge *E)
 
bool FirstIsBottomPt (const OutPt *btmPt1, const OutPt *btmPt2)
 
OutPtGetBottomPt (OutPt *pp)
 
double GetDx (const IntPoint pt1, const IntPoint pt2)
 
void GetHorzDirection (TEdge &HorzEdge, Direction &Dir, cInt &Left, cInt &Right)
 
OutRecGetLowermostRec (OutRec *outRec1, OutRec *outRec2)
 
TEdgeGetMaximaPair (TEdge *e)
 
TEdgeGetNextInAEL (TEdge *e, Direction dir)
 
bool GetOverlap (const cInt a1, const cInt a2, const cInt b1, const cInt b2, cInt &Left, cInt &Right)
 
bool GetOverlapSegment (IntPoint pt1a, IntPoint pt1b, IntPoint pt2a, IntPoint pt2b, IntPoint &pt1, IntPoint &pt2)
 
DoublePoint GetUnitNormal (const IntPoint &pt1, const IntPoint &pt2)
 
bool HorzSegmentsOverlap (cInt seg1a, cInt seg1b, cInt seg2a, cInt seg2b)
 
void InitEdge (TEdge *e, TEdge *eNext, TEdge *ePrev, const IntPoint &Pt)
 
void InitEdge2 (TEdge &e, PolyType Pt)
 
Int128 Int128Mul (long64 lhs, long64 rhs)
 
bool IntersectListSort (IntersectNode *node1, IntersectNode *node2)
 
void IntersectPoint (TEdge &Edge1, TEdge &Edge2, IntPoint &ip)
 
bool IsHorizontal (TEdge &e)
 
bool IsIntermediate (TEdge *e, const cInt Y)
 
bool IsMaxima (TEdge *e, const cInt Y)
 
bool IsMinima (TEdge *e)
 
bool JoinHorz (OutPt *op1, OutPt *op1b, OutPt *op2, OutPt *op2b, const IntPoint Pt, bool DiscardLeft)
 
void Minkowski (const Path &poly, const Path &path, Paths &solution, bool isSum, bool isClosed)
 
void MinkowskiDiff (const Path &poly1, const Path &poly2, Paths &solution)
 
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 OpenPathsFromPolyTree (PolyTree &polytree, Paths &paths)
 
Pathoperator<< (Path &poly, const IntPoint &p)
 
Pathsoperator<< (Paths &polys, const Path &p)
 
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)
 
bool Orientation (const Path &poly)
 
bool Param1RightOfParam2 (OutRec *outRec1, OutRec *outRec2)
 
static OutRecParseFirstLeft (OutRec *FirstLeft)
 
int PointCount (OutPt *Pts)
 
int PointInPolygon (const IntPoint &pt, const Path &path)
 
int PointInPolygon (const IntPoint &pt, OutPt *op)
 
bool PointIsVertex (const IntPoint &Pt, OutPt *pp)
 
bool PointsAreClose (IntPoint pt1, IntPoint pt2, double distSqrd)
 
bool Poly2ContainsPoly1 (OutPt *OutPt1, OutPt *OutPt2)
 
void PolyTreeToPaths (const PolyTree &polytree, Paths &paths)
 
bool Pt2IsBetweenPt1AndPt3 (const IntPoint pt1, const IntPoint pt2, const IntPoint pt3)
 
void RangeTest (const IntPoint &Pt, bool &useFullRange)
 
TEdgeRemoveEdge (TEdge *e)
 
void ReverseHorizontal (TEdge &e)
 
void ReversePath (Path &p)
 
void ReversePaths (Paths &p)
 
void ReversePolyPtLinks (OutPt *pp)
 
cInt Round (double val)
 
void SetDx (TEdge &e)
 
void SimplifyPolygon (const Path &in_poly, Paths &out_polys, PolyFillType fillType)
 
void SimplifyPolygons (const Paths &in_polys, Paths &out_polys, PolyFillType fillType)
 
void SimplifyPolygons (Paths &polys, PolyFillType fillType)
 
bool SlopesEqual (const IntPoint pt1, const IntPoint pt2, const IntPoint pt3, bool UseFullInt64Range)
 
bool SlopesEqual (const IntPoint pt1, const IntPoint pt2, const IntPoint pt3, const IntPoint pt4, bool UseFullInt64Range)
 
bool SlopesEqual (const TEdge &e1, const TEdge &e2, bool UseFullInt64Range)
 
bool SlopesNearCollinear (const IntPoint &pt1, const IntPoint &pt2, const IntPoint &pt3, double distSqrd)
 
void Swap (cInt &val1, cInt &val2)
 
void SwapIntersectNodes (IntersectNode &int1, IntersectNode &int2)
 
void SwapPoints (IntPoint &pt1, IntPoint &pt2)
 
void SwapPolyIndexes (TEdge &Edge1, TEdge &Edge2)
 
void SwapSides (TEdge &Edge1, TEdge &Edge2)
 
cInt TopX (TEdge &edge, const cInt currentY)
 
void TranslatePath (const Path &input, Path &output, IntPoint delta)
 
void UpdateOutPtIdxs (OutRec &outrec)
 

Variables

static const double def_arc_tolerance = 0.25
 
static const cInt hiRange = 0x3FFFFFFFFFFFFFFFLL
 
static const cInt loRange = 0x3FFFFFFF
 
static const double pi = 3.141592653589793238
 
static const int Skip = -2
 
static const double two_pi = pi *2
 
static const int Unassigned = -1
 

Typedef Documentation

◆ cInt

typedef signed long long ClipperLib::cInt

◆ EdgeList

typedef std::vector< TEdge* > ClipperLib::EdgeList

◆ IntersectList

typedef std::vector< IntersectNode* > ClipperLib::IntersectList

◆ JoinList

typedef std::vector< Join* > ClipperLib::JoinList

◆ long64

typedef signed long long ClipperLib::long64

◆ Path

typedef std::vector< IntPoint > ClipperLib::Path

◆ Paths

typedef std::vector< Path > ClipperLib::Paths

◆ PolyNodes

typedef std::vector< PolyNode* > ClipperLib::PolyNodes

◆ PolyOutList

typedef std::vector< OutRec* > ClipperLib::PolyOutList

◆ ulong64

typedef unsigned long long ClipperLib::ulong64

Enumeration Type Documentation

◆ ClipType

Enumerator
ctIntersection 
ctUnion 
ctDifference 
ctXor 

◆ Direction

Enumerator
dRightToLeft 
dLeftToRight 

◆ EdgeSide

Enumerator
esLeft 
esRight 

◆ EndType

Enumerator
etClosedPolygon 
etClosedLine 
etOpenButt 
etOpenSquare 
etOpenRound 

◆ InitOptions

Enumerator
ioReverseSolution 
ioStrictlySimple 
ioPreserveCollinear 

◆ JoinType

Enumerator
jtSquare 
jtRound 
jtMiter 

◆ NodeType

Enumerator
ntAny 
ntOpen 
ntClosed 

◆ PolyFillType

Enumerator
pftEvenOdd 
pftNonZero 
pftPositive 
pftNegative 

◆ PolyType

Enumerator
ptSubject 
ptClip 

Function Documentation

◆ Abs()

cInt ClipperLib::Abs ( cInt  val)

◆ AddPolyNodeToPaths()

void ClipperLib::AddPolyNodeToPaths ( const PolyNode polynode,
NodeType  nodetype,
Paths paths 
)

◆ Area() [1/2]

double ClipperLib::Area ( const OutRec outRec)

◆ Area() [2/2]

double ClipperLib::Area ( const Path poly)

Referenced by ParseFirstLeft().

◆ CleanPolygon() [1/2]

void ClipperLib::CleanPolygon ( const Path in_poly,
Path out_poly,
double  distance 
)

Referenced by AdaptivePath::CleanPath().

◆ CleanPolygon() [2/2]

void ClipperLib::CleanPolygon ( Path poly,
double  distance 
)

◆ CleanPolygons() [1/2]

void ClipperLib::CleanPolygons ( const Paths in_polys,
Paths out_polys,
double  distance 
)

◆ CleanPolygons() [2/2]

void ClipperLib::CleanPolygons ( Paths polys,
double  distance 
)

◆ ClosedPathsFromPolyTree()

void ClipperLib::ClosedPathsFromPolyTree ( const PolyTree polytree,
Paths paths 
)

Referenced by CArea::Clip().

◆ DisposeOutPts()

void ClipperLib::DisposeOutPts ( OutPt *&  pp)

References RemoveEdge().

◆ DistanceFromLineSqrd()

double ClipperLib::DistanceFromLineSqrd ( const IntPoint pt,
const IntPoint ln1,
const IntPoint ln2 
)

Referenced by SimplifyPolygons().

◆ DistanceSqrd()

double ClipperLib::DistanceSqrd ( const IntPoint pt1,
const IntPoint pt2 
)

◆ DupOutPt()

OutPt* ClipperLib::DupOutPt ( OutPt outPt,
bool  InsertAfter 
)

References ClipperLib::OutPt::Pt.

◆ E2InsertsBeforeE1()

bool ClipperLib::E2InsertsBeforeE1 ( TEdge e1,
TEdge e2 
)

◆ EdgesAdjacent()

bool ClipperLib::EdgesAdjacent ( const IntersectNode inode)

◆ ExcludeOp()

OutPt* ClipperLib::ExcludeOp ( OutPt op)

◆ FindNextLocMin()

TEdge* ClipperLib::FindNextLocMin ( TEdge E)

References IsHorizontal().

◆ FirstIsBottomPt()

bool ClipperLib::FirstIsBottomPt ( const OutPt btmPt1,
const OutPt btmPt2 
)

◆ GetBottomPt()

OutPt* ClipperLib::GetBottomPt ( OutPt pp)

◆ GetDx()

double ClipperLib::GetDx ( const IntPoint  pt1,
const IntPoint  pt2 
)

References Round().

Referenced by GetOverlapSegment(), and SwapPoints().

◆ GetHorzDirection()

void ClipperLib::GetHorzDirection ( TEdge HorzEdge,
Direction Dir,
cInt Left,
cInt Right 
)

◆ GetLowermostRec()

OutRec* ClipperLib::GetLowermostRec ( OutRec outRec1,
OutRec outRec2 
)

Referenced by ParseFirstLeft().

◆ GetMaximaPair()

TEdge* ClipperLib::GetMaximaPair ( TEdge e)

Referenced by IntersectListSort().

◆ GetNextInAEL()

TEdge* ClipperLib::GetNextInAEL ( TEdge e,
Direction  dir 
)

◆ GetOverlap()

bool ClipperLib::GetOverlap ( const cInt  a1,
const cInt  a2,
const cInt  b1,
const cInt  b2,
cInt Left,
cInt Right 
)

◆ GetOverlapSegment()

bool ClipperLib::GetOverlapSegment ( IntPoint  pt1a,
IntPoint  pt1b,
IntPoint  pt2a,
IntPoint  pt2b,
IntPoint pt1,
IntPoint pt2 
)

References GetDx().

◆ GetUnitNormal()

DoublePoint ClipperLib::GetUnitNormal ( const IntPoint pt1,
const IntPoint pt2 
)

◆ HorzSegmentsOverlap()

bool ClipperLib::HorzSegmentsOverlap ( cInt  seg1a,
cInt  seg1b,
cInt  seg2a,
cInt  seg2b 
)

References RangeTest().

◆ InitEdge()

void ClipperLib::InitEdge ( TEdge e,
TEdge eNext,
TEdge ePrev,
const IntPoint Pt 
)

References ReverseHorizontal(), and Swap().

◆ InitEdge2()

void ClipperLib::InitEdge2 ( TEdge e,
PolyType  Pt 
)

Referenced by ReversePolyPtLinks().

◆ Int128Mul()

Int128 ClipperLib::Int128Mul ( long64  lhs,
long64  rhs 
)

◆ IntersectListSort()

bool ClipperLib::IntersectListSort ( IntersectNode node1,
IntersectNode node2 
)

References GetMaximaPair().

◆ IntersectPoint()

void ClipperLib::IntersectPoint ( TEdge Edge1,
TEdge Edge2,
IntPoint ip 
)

References Round().

◆ IsHorizontal()

bool ClipperLib::IsHorizontal ( TEdge e)

◆ IsIntermediate()

bool ClipperLib::IsIntermediate ( TEdge e,
const cInt  Y 
)

◆ IsMaxima()

bool ClipperLib::IsMaxima ( TEdge e,
const cInt  Y 
)

◆ IsMinima()

bool ClipperLib::IsMinima ( TEdge e)

◆ JoinHorz()

bool ClipperLib::JoinHorz ( OutPt op1,
OutPt op1b,
OutPt op2,
OutPt op2b,
const IntPoint  Pt,
bool  DiscardLeft 
)

◆ Minkowski()

void ClipperLib::Minkowski ( const Path poly,
const Path path,
Paths solution,
bool  isSum,
bool  isClosed 
)

Referenced by MinkowskiSum().

◆ MinkowskiDiff()

void ClipperLib::MinkowskiDiff ( const Path poly1,
const Path poly2,
Paths solution 
)

◆ MinkowskiSum() [1/2]

void ClipperLib::MinkowskiSum ( const Path pattern,
const Path path,
Paths solution,
bool  pathIsClosed 
)

◆ MinkowskiSum() [2/2]

void ClipperLib::MinkowskiSum ( const Path pattern,
const Paths paths,
Paths solution,
bool  pathIsClosed 
)

◆ OpenPathsFromPolyTree()

void ClipperLib::OpenPathsFromPolyTree ( PolyTree polytree,
Paths paths 
)

Referenced by CArea::Clip().

◆ operator<<() [1/5]

Path& ClipperLib::operator<< ( Path poly,
const IntPoint p 
)

◆ operator<<() [2/5]

Paths& ClipperLib::operator<< ( Paths polys,
const Path p 
)

◆ operator<<() [3/5]

std::ostream & ClipperLib::operator<< ( std::ostream &  s,
const IntPoint p 
)

◆ operator<<() [4/5]

std::ostream & ClipperLib::operator<< ( std::ostream &  s,
const Path p 
)

◆ operator<<() [5/5]

std::ostream & ClipperLib::operator<< ( std::ostream &  s,
const Paths p 
)

◆ Orientation()

bool ClipperLib::Orientation ( const Path poly)

◆ Param1RightOfParam2()

bool ClipperLib::Param1RightOfParam2 ( OutRec outRec1,
OutRec outRec2 
)

◆ ParseFirstLeft()

static OutRec* ClipperLib::ParseFirstLeft ( OutRec FirstLeft)
static

◆ PointCount()

◆ PointInPolygon() [1/2]

int ClipperLib::PointInPolygon ( const IntPoint pt,
const Path path 
)

◆ PointInPolygon() [2/2]

int ClipperLib::PointInPolygon ( const IntPoint pt,
OutPt op 
)

◆ PointIsVertex()

bool ClipperLib::PointIsVertex ( const IntPoint Pt,
OutPt pp 
)

◆ PointsAreClose()

bool ClipperLib::PointsAreClose ( IntPoint  pt1,
IntPoint  pt2,
double  distSqrd 
)

◆ Poly2ContainsPoly1()

bool ClipperLib::Poly2ContainsPoly1 ( OutPt OutPt1,
OutPt OutPt2 
)

◆ PolyTreeToPaths()

void ClipperLib::PolyTreeToPaths ( const PolyTree polytree,
Paths paths 
)

◆ Pt2IsBetweenPt1AndPt3()

bool ClipperLib::Pt2IsBetweenPt1AndPt3 ( const IntPoint  pt1,
const IntPoint  pt2,
const IntPoint  pt3 
)

◆ RangeTest()

void ClipperLib::RangeTest ( const IntPoint Pt,
bool useFullRange 
)

◆ RemoveEdge()

TEdge* ClipperLib::RemoveEdge ( TEdge e)

References SwapPoints().

Referenced by DisposeOutPts().

◆ ReverseHorizontal()

void ClipperLib::ReverseHorizontal ( TEdge e)

Referenced by InitEdge().

◆ ReversePath()

void ClipperLib::ReversePath ( Path p)

◆ ReversePaths()

void ClipperLib::ReversePaths ( Paths p)

◆ ReversePolyPtLinks()

void ClipperLib::ReversePolyPtLinks ( OutPt pp)

References InitEdge2(), and SetDx().

Referenced by Param1RightOfParam2(), and ParseFirstLeft().

◆ Round()

cInt ClipperLib::Round ( double  val)

◆ SetDx()

void ClipperLib::SetDx ( TEdge e)

References TopX().

Referenced by ReversePolyPtLinks(), and SlopesEqual().

◆ SimplifyPolygon()

void ClipperLib::SimplifyPolygon ( const Path in_poly,
Paths out_polys,
PolyFillType  fillType 
)

◆ SimplifyPolygons() [1/2]

void ClipperLib::SimplifyPolygons ( const Paths in_polys,
Paths out_polys,
PolyFillType  fillType 
)

◆ SimplifyPolygons() [2/2]

void ClipperLib::SimplifyPolygons ( Paths polys,
PolyFillType  fillType 
)

◆ SlopesEqual() [1/3]

bool ClipperLib::SlopesEqual ( const IntPoint  pt1,
const IntPoint  pt2,
const IntPoint  pt3,
bool  UseFullInt64Range 
)

References SetDx().

◆ SlopesEqual() [2/3]

bool ClipperLib::SlopesEqual ( const IntPoint  pt1,
const IntPoint  pt2,
const IntPoint  pt3,
const IntPoint  pt4,
bool  UseFullInt64Range 
)

◆ SlopesEqual() [3/3]

bool ClipperLib::SlopesEqual ( const TEdge e1,
const TEdge e2,
bool  UseFullInt64Range 
)

Referenced by Poly2ContainsPoly1().

◆ SlopesNearCollinear()

bool ClipperLib::SlopesNearCollinear ( const IntPoint pt1,
const IntPoint pt2,
const IntPoint pt3,
double  distSqrd 
)

◆ Swap()

void ClipperLib::Swap ( cInt val1,
cInt val2 
)

Referenced by InitEdge().

◆ SwapIntersectNodes()

void ClipperLib::SwapIntersectNodes ( IntersectNode int1,
IntersectNode int2 
)

◆ SwapPoints()

void ClipperLib::SwapPoints ( IntPoint pt1,
IntPoint pt2 
)

References GetDx().

Referenced by RemoveEdge().

◆ SwapPolyIndexes()

void ClipperLib::SwapPolyIndexes ( TEdge Edge1,
TEdge Edge2 
)

References Round().

◆ SwapSides()

void ClipperLib::SwapSides ( TEdge Edge1,
TEdge Edge2 
)

References IsHorizontal().

◆ TopX()

cInt ClipperLib::TopX ( TEdge edge,
const cInt  currentY 
)

References Round().

Referenced by SetDx().

◆ TranslatePath()

void ClipperLib::TranslatePath ( const Path input,
Path output,
IntPoint  delta 
)

References ntAny, ntClosed, and ntOpen.

Referenced by AdaptivePath::Adaptive2d::Execute().

◆ UpdateOutPtIdxs()

void ClipperLib::UpdateOutPtIdxs ( OutRec outrec)

Referenced by ParseFirstLeft().

Variable Documentation

◆ def_arc_tolerance

const double ClipperLib::def_arc_tolerance = 0.25
static

◆ hiRange

const cInt ClipperLib::hiRange = 0x3FFFFFFFFFFFFFFFLL
static

◆ loRange

const cInt ClipperLib::loRange = 0x3FFFFFFF
static

◆ pi

const double ClipperLib::pi = 3.141592653589793238
static

◆ Skip

const int ClipperLib::Skip = -2
static

◆ two_pi

const double ClipperLib::two_pi = pi *2
static

◆ Unassigned

const int ClipperLib::Unassigned = -1
static