Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
31332c39
Commit
31332c39
authored
Nov 20, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polygon: update clipper lib.
parent
1dd0adf7
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
320 additions
and
214 deletions
+320
-214
clipper.cpp
polygon/clipper.cpp
+307
-203
clipper.hpp
polygon/clipper.hpp
+13
-11
No files found.
polygon/clipper.cpp
View file @
31332c39
This diff is collapsed.
Click to expand it.
polygon/clipper.hpp
View file @
31332c39
/*******************************************************************************
/*******************************************************************************
* *
* *
* Author : Angus Johnson *
* Author : Angus Johnson *
* Version : 4.
8.5
*
* Version : 4.
9.6
*
* Date :
15 July 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 *
* *
* *
...
@@ -78,13 +78,13 @@ enum JoinType { jtSquare, jtRound, jtMiter };
...
@@ -78,13 +78,13 @@ 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
CheckInputs
=
true
);
void
SimplifyPolygon
(
const
Polygon
&
in_poly
,
Polygons
&
out_polys
);
void
SimplifyPolygon
(
const
Polygon
&
in_poly
,
Polygons
&
out_polys
,
PolyFillType
fillType
=
pftEvenOdd
);
void
SimplifyPolygons
(
const
Polygons
&
in_polys
,
Polygons
&
out_polys
);
void
SimplifyPolygons
(
const
Polygons
&
in_polys
,
Polygons
&
out_polys
,
PolyFillType
fillType
=
pftEvenOdd
);
void
SimplifyPolygons
(
Polygons
&
polys
);
void
SimplifyPolygons
(
Polygons
&
polys
,
PolyFillType
fillType
=
pftEvenOdd
);
void
ReversePo
ints
(
Polygon
&
p
);
void
ReversePo
lygon
(
Polygon
&
p
);
void
ReversePo
int
s
(
Polygons
&
p
);
void
ReversePo
lygon
s
(
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
};
...
@@ -98,6 +98,8 @@ struct TEdge {
...
@@ -98,6 +98,8 @@ struct TEdge {
long64
xtop
;
long64
xtop
;
long64
ytop
;
long64
ytop
;
double
dx
;
double
dx
;
long64
deltaX
;
long64
deltaY
;
long64
tmpX
;
long64
tmpX
;
PolyType
polyType
;
PolyType
polyType
;
EdgeSide
side
;
EdgeSide
side
;
...
@@ -257,7 +259,7 @@ private:
...
@@ -257,7 +259,7 @@ private:
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
);
...
@@ -276,12 +278,12 @@ private:
...
@@ -276,12 +278,12 @@ private:
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
CheckHoleLinkages1
(
OutRec
*
outRec1
,
OutRec
*
outRec2
);
void
CheckHoleLinkages2
(
OutRec
*
outRec1
,
OutRec
*
outRec2
);
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
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment