From f7b4cc602b9a646fbc66f3f17d6bb9c20efc3ead Mon Sep 17 00:00:00 2001
From: jaseg
Date: Sun, 24 Jan 2021 18:44:56 +0100
Subject: [PATCH] Initial commit
---
.gitignore | 1 +
.gitmodules | 9 +
Makefile | 45 +
src/svg_color.cpp | 125 +
src/svg_color.h | 59 +
src/svg_doc.cpp | 462 ++
src/svg_doc.h | 97 +
src/svg_geom.cpp | 181 +
src/svg_geom.h | 44 +
src/svg_import_defs.h | 49 +
src/svg_import_util.cpp | 129 +
src/svg_import_util.h | 69 +
src/svg_path.cpp | 219 +
src/svg_path.h | 38 +
src/svg_pattern.cpp | 119 +
src/svg_pattern.h | 60 +
src/vec_core.cpp | 339 ++
src/vec_core.h | 37 +
src/vec_grid.cpp | 105 +
src/vec_grid.h | 52 +
.../Documentation/Docs/Overview/Changes.htm | 1269 +++++
.../Docs/Overview/Deprecated.htm | 69 +
.../Documentation/Docs/Overview/Example.htm | 234 +
.../Documentation/Docs/Overview/FAQ.htm | 104 +
.../Documentation/Docs/Overview/License.htm | 75 +
.../Documentation/Docs/Overview/Rounding.htm | 71 +
.../Documentation/Docs/Overview/_Body.htm | 106 +
.../Classes/Clipper/Methods/Constructor.htm | 95 +
.../Classes/Clipper/Methods/Execute.htm | 91 +
.../Clipper/Properties/PreserveCollinear.htm | 74 +
.../Clipper/Properties/ReverseSolution.htm | 76 +
.../Clipper/Properties/StrictlySimple.htm | 88 +
.../Clipper/Properties/ZFillFunction.htm | 75 +
.../ClipperLib/Classes/Clipper/_Body.htm | 149 +
.../Classes/ClipperBase/Methods/AddPath.htm | 95 +
.../Classes/ClipperBase/Methods/AddPaths.htm | 93 +
.../Classes/ClipperBase/Methods/Clear.htm | 71 +
.../Classes/ClipperBase/Methods/GetBounds.htm | 76 +
.../ClipperLib/Classes/ClipperBase/_Body.htm | 91 +
.../Classes/ClipperOffset/Methods/AddPath.htm | 73 +
.../ClipperOffset/Methods/AddPaths.htm | 74 +
.../Classes/ClipperOffset/Methods/Clear.htm | 72 +
.../ClipperOffset/Methods/Constructor.htm | 74 +
.../Classes/ClipperOffset/Methods/Execute.htm | 111 +
.../ClipperOffset/Properties/ArcTolerance.htm | 74 +
.../ClipperOffset/Properties/MiterLimit.htm | 75 +
.../Classes/ClipperOffset/_Body.htm | 136 +
.../Classes/PolyNode/Methods/GetNext.htm | 97 +
.../PolyNode/Properties/ChildCount.htm | 74 +
.../Classes/PolyNode/Properties/Childs.htm | 75 +
.../Classes/PolyNode/Properties/Contour.htm | 69 +
.../Classes/PolyNode/Properties/IsHole.htm | 72 +
.../Classes/PolyNode/Properties/IsOpen.htm | 72 +
.../Classes/PolyNode/Properties/Parent.htm | 69 +
.../ClipperLib/Classes/PolyNode/_Body.htm | 125 +
.../Classes/PolyTree/Methods/Clear.htm | 73 +
.../Classes/PolyTree/Methods/GetFirst.htm | 77 +
.../Classes/PolyTree/Properties/Total.htm | 74 +
.../ClipperLib/Classes/PolyTree/_Body.htm | 189 +
.../Docs/Units/ClipperLib/Functions/Area.htm | 72 +
.../ClipperLib/Functions/CleanPolygon.htm | 88 +
.../ClipperLib/Functions/CleanPolygons.htm | 87 +
.../Functions/ClosedPathsFromPolyTree.htm | 71 +
.../ClipperLib/Functions/MinkowskiDiff.htm | 74 +
.../ClipperLib/Functions/MinkowskiSum.htm | 101 +
.../ClipperLib/Functions/OffsetPaths.htm | 70 +
.../Functions/OpenPathsFromPolyTree.htm | 71 +
.../ClipperLib/Functions/Orientation.htm | 92 +
.../ClipperLib/Functions/PointInPolygon.htm | 72 +
.../ClipperLib/Functions/PolyTreeToPaths.htm | 71 +
.../ClipperLib/Functions/ReversePath.htm | 71 +
.../ClipperLib/Functions/ReversePaths.htm | 70 +
.../ClipperLib/Functions/SimplifyPolygon.htm | 75 +
.../ClipperLib/Functions/SimplifyPolygons.htm | 76 +
.../Docs/Units/ClipperLib/Types/CInt.htm | 70 +
.../Docs/Units/ClipperLib/Types/ClipType.htm | 100 +
.../Docs/Units/ClipperLib/Types/EndType.htm | 88 +
.../Units/ClipperLib/Types/InitOptions.htm | 75 +
.../Docs/Units/ClipperLib/Types/IntPoint.htm | 73 +
.../Docs/Units/ClipperLib/Types/IntRect.htm | 69 +
.../Docs/Units/ClipperLib/Types/JoinType.htm | 78 +
.../Docs/Units/ClipperLib/Types/Path.htm | 69 +
.../Docs/Units/ClipperLib/Types/Paths.htm | 76 +
.../Units/ClipperLib/Types/PolyFillType.htm | 83 +
.../Docs/Units/ClipperLib/Types/PolyType.htm | 73 +
.../Units/ClipperLib/Types/ZFillCallback.htm | 71 +
.../Docs/Units/ClipperLib/_Body.htm | 188 +
.../Documentation/Docs/_Body.htm | 168 +
.../Documentation/Images/_BranchEmpty.gif | Bin 0 -> 56 bytes
.../Documentation/Images/_BranchRight.gif | Bin 0 -> 62 bytes
.../Documentation/Images/_BranchVert.gif | Bin 0 -> 64 bytes
.../Documentation/Images/_BranchVertRight.gif | Bin 0 -> 65 bytes
.../Documentation/Images/_Class.gif | Bin 0 -> 118 bytes
.../Documentation/Images/_Home.gif | Bin 0 -> 125 bytes
.../Documentation/Images/_Project_Logo.gif | Bin 0 -> 1589 bytes
.../Documentation/Images/_Unit.gif | Bin 0 -> 171 bytes
.../Documentation/Images/_buttons.gif | Bin 0 -> 311 bytes
.../Documentation/Images/clean1.png | Bin 0 -> 1303 bytes
.../Documentation/Images/clean2.png | Bin 0 -> 2235 bytes
.../Documentation/Images/clipper_rounding.png | Bin 0 -> 10568 bytes
.../Images/clipper_rounding2.png | Bin 0 -> 21776 bytes
.../Images/clipper_rounding3.png | Bin 0 -> 8120 bytes
.../Images/clipper_rounding4.png | Bin 0 -> 5043 bytes
.../Documentation/Images/cliptype.png | Bin 0 -> 4267 bytes
.../Documentation/Images/common_edges.png | Bin 0 -> 66132 bytes
.../Documentation/Images/difference.png | Bin 0 -> 3873 bytes
.../Documentation/Images/endtypes1.png | Bin 0 -> 3259 bytes
.../Documentation/Images/endtypes2.png | Bin 0 -> 2832 bytes
.../Documentation/Images/evenodd.png | Bin 0 -> 2985 bytes
.../Documentation/Images/int.png | Bin 0 -> 69459 bytes
.../Documentation/Images/intersection.png | Bin 0 -> 3814 bytes
.../Documentation/Images/jointypes.png | Bin 0 -> 5656 bytes
.../Documentation/Images/kangaroo_small.png | Bin 0 -> 44887 bytes
.../Documentation/Images/line_clipping.png | Bin 0 -> 40765 bytes
.../Documentation/Images/line_clipping2.png | Bin 0 -> 25061 bytes
.../Documentation/Images/linesdemo.png | Bin 0 -> 42798 bytes
.../Documentation/Images/minkowski.png | Bin 0 -> 2489 bytes
.../Documentation/Images/minkowski2.png | Bin 0 -> 2248 bytes
.../Documentation/Images/miterlimit.png | Bin 0 -> 2204 bytes
.../Documentation/Images/negative.png | Bin 0 -> 2738 bytes
.../Documentation/Images/nonzero.png | Bin 0 -> 2966 bytes
.../Documentation/Images/offset1.png | Bin 0 -> 16245 bytes
.../Documentation/Images/orientation.png | Bin 0 -> 3199 bytes
.../Documentation/Images/polytree.png | Bin 0 -> 5717 bytes
.../Documentation/Images/positive.png | Bin 0 -> 3000 bytes
.../Documentation/Images/sample1.png | Bin 0 -> 17499 bytes
.../Documentation/Images/simplify.png | Bin 0 -> 5336 bytes
.../Documentation/Images/simplify2.png | Bin 0 -> 12488 bytes
.../Documentation/Images/simplify3.png | Bin 0 -> 9373 bytes
.../Documentation/Images/union.png | Bin 0 -> 3874 bytes
.../Documentation/Images/winding_number.png | Bin 0 -> 7913 bytes
.../clipper-6.4.2/Documentation/Images/wn.png | Bin 0 -> 504 bytes
.../Documentation/Images/xor.png | Bin 0 -> 4151 bytes
.../Documentation/Images/zfill.png | Bin 0 -> 5762 bytes
.../compass/_theme_template.scss | 120 +
.../SyntaxHighlighter/compass/config.rb | 14 +
.../SyntaxHighlighter/compass/shCore.scss | 216 +
.../compass/shCoreDefault.scss | 2 +
.../compass/shCoreDjango.scss | 2 +
.../compass/shCoreEclipse.scss | 2 +
.../compass/shCoreEmacs.scss | 2 +
.../compass/shCoreFadeToGrey.scss | 2 +
.../compass/shCoreMDUltra.scss | 2 +
.../compass/shCoreMidnight.scss | 2 +
.../compass/shCoreRDark.scss | 2 +
.../compass/shThemeDefault.scss | 7 +
.../compass/shThemeDjango.scss | 36 +
.../compass/shThemeEclipse.scss | 48 +
.../compass/shThemeEmacs.scss | 32 +
.../compass/shThemeFadeToGrey.scss | 36 +
.../compass/shThemeMDUltra.scss | 32 +
.../compass/shThemeMidnight.scss | 32 +
.../compass/shThemeRDark.scss | 32 +
.../Scripts/SyntaxHighlighter/index.html | 22 +
.../SyntaxHighlighter/scripts/shAutoloader.js | 17 +
.../SyntaxHighlighter/scripts/shBrushAS3.js | 59 +
.../scripts/shBrushAppleScript.js | 75 +
.../SyntaxHighlighter/scripts/shBrushBash.js | 59 +
.../scripts/shBrushCSharp.js | 70 +
.../scripts/shBrushColdFusion.js | 100 +
.../SyntaxHighlighter/scripts/shBrushCpp.js | 97 +
.../SyntaxHighlighter/scripts/shBrushCss.js | 91 +
.../scripts/shBrushDelphi.js | 55 +
.../SyntaxHighlighter/scripts/shBrushDiff.js | 41 +
.../scripts/shBrushErlang.js | 52 +
.../scripts/shBrushGroovy.js | 67 +
.../scripts/shBrushJScript.js | 52 +
.../SyntaxHighlighter/scripts/shBrushJava.js | 57 +
.../scripts/shBrushJavaFX.js | 58 +
.../SyntaxHighlighter/scripts/shBrushPerl.js | 72 +
.../SyntaxHighlighter/scripts/shBrushPhp.js | 88 +
.../SyntaxHighlighter/scripts/shBrushPlain.js | 33 +
.../scripts/shBrushPowerShell.js | 74 +
.../scripts/shBrushPython.js | 64 +
.../SyntaxHighlighter/scripts/shBrushRuby.js | 55 +
.../SyntaxHighlighter/scripts/shBrushSass.js | 94 +
.../SyntaxHighlighter/scripts/shBrushScala.js | 51 +
.../SyntaxHighlighter/scripts/shBrushSql.js | 66 +
.../SyntaxHighlighter/scripts/shBrushVb.js | 56 +
.../SyntaxHighlighter/scripts/shBrushXml.js | 69 +
.../SyntaxHighlighter/scripts/shCore.js | 17 +
.../SyntaxHighlighter/scripts/shLegacy.js | 17 +
.../SyntaxHighlighter/src/shAutoloader.js | 130 +
.../Scripts/SyntaxHighlighter/src/shCore.js | 1721 ++++++
.../Scripts/SyntaxHighlighter/src/shLegacy.js | 157 +
.../SyntaxHighlighter/styles/shCore.css | 226 +
.../styles/shCoreDefault.css | 328 ++
.../SyntaxHighlighter/styles/shCoreDjango.css | 331 ++
.../styles/shCoreEclipse.css | 339 ++
.../SyntaxHighlighter/styles/shCoreEmacs.css | 324 ++
.../styles/shCoreFadeToGrey.css | 328 ++
.../styles/shCoreMDUltra.css | 324 ++
.../styles/shCoreMidnight.css | 324 ++
.../SyntaxHighlighter/styles/shCoreRDark.css | 324 ++
.../styles/shThemeDefault.css | 119 +
.../styles/shThemeDjango.css | 120 +
.../styles/shThemeEclipse.css | 128 +
.../SyntaxHighlighter/styles/shThemeEmacs.css | 113 +
.../styles/shThemeFadeToGrey.css | 117 +
.../styles/shThemeMDUltra.css | 113 +
.../styles/shThemeMidnight.css | 113 +
.../SyntaxHighlighter/styles/shThemeRDark.css | 113 +
.../Documentation/Scripts/bootstrap.js | 2 +
.../Documentation/Scripts/expandable.js | 190 +
.../Documentation/Scripts/menu_data.js | 21 +
.../Documentation/Scripts/menu_script.js | 130 +
.../Documentation/Styles/default.css | 304 ++
.../clipper-6.4.2/Documentation/clipper.chm | Bin 0 -> 528964 bytes
.../clipper-6.4.2/Documentation/default.css | 304 ++
.../clipper-6.4.2/Documentation/index.htm | 12 +
.../Documentation/offset_triginometry.svg | 42 +
.../Documentation/offset_triginometry2.svg | 28 +
.../Documentation/offset_triginometry3.svg | 391 ++
upstream/clipper-6.4.2/License.txt | 24 +
upstream/clipper-6.4.2/README | 413 ++
upstream/clipper-6.4.2/cpp/CMakeLists.txt | 21 +
upstream/clipper-6.4.2/cpp/clipper.cpp | 4629 +++++++++++++++++
upstream/clipper-6.4.2/cpp/clipper.hpp | 406 ++
.../cpp/cpp_cairo/Cairo Resources.txt | 6 +
.../clipper-6.4.2/cpp/cpp_cairo/cairo.sln | 20 +
.../clipper-6.4.2/cpp/cpp_cairo/cairo.vcxproj | 93 +
.../cpp/cpp_cairo/cairo_clipper.cpp | 133 +
.../cpp/cpp_cairo/cairo_clipper.hpp | 59 +
.../cpp/cpp_cairo/cairo_clipper.o | Bin 0 -> 226800 bytes
.../cpp/cpp_cairo/libcairo-2.lib | Bin 0 -> 83700 bytes
upstream/clipper-6.4.2/cpp/cpp_cairo/main.cpp | 182 +
.../clipper-6.4.2/cpp/polyclipping.pc.cmakein | 13 +
upstream/cpp-base64 | 1 +
upstream/poisson-disk-sampling | 1 +
upstream/voronoi | 1 +
230 files changed, 25005 insertions(+)
create mode 100644 .gitignore
create mode 100644 .gitmodules
create mode 100644 Makefile
create mode 100644 src/svg_color.cpp
create mode 100644 src/svg_color.h
create mode 100644 src/svg_doc.cpp
create mode 100644 src/svg_doc.h
create mode 100644 src/svg_geom.cpp
create mode 100644 src/svg_geom.h
create mode 100644 src/svg_import_defs.h
create mode 100644 src/svg_import_util.cpp
create mode 100644 src/svg_import_util.h
create mode 100644 src/svg_path.cpp
create mode 100644 src/svg_path.h
create mode 100644 src/svg_pattern.cpp
create mode 100644 src/svg_pattern.h
create mode 100644 src/vec_core.cpp
create mode 100644 src/vec_core.h
create mode 100644 src/vec_grid.cpp
create mode 100644 src/vec_grid.h
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Overview/Changes.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Overview/Deprecated.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Overview/Example.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Overview/FAQ.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Overview/License.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Overview/Rounding.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Overview/_Body.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Constructor.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Execute.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/PreserveCollinear.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/ReverseSolution.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/StrictlySimple.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/ZFillFunction.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/_Body.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPath.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPaths.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/Clear.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/GetBounds.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/_Body.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/AddPath.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/AddPaths.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Clear.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Constructor.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Execute.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/ArcTolerance.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/MiterLimit.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/_Body.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Methods/GetNext.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/ChildCount.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Childs.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Contour.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/IsHole.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/IsOpen.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Parent.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/_Body.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Methods/Clear.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Methods/GetFirst.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Properties/Total.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/_Body.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/Area.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/CleanPolygon.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/CleanPolygons.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ClosedPathsFromPolyTree.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/MinkowskiDiff.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/MinkowskiSum.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/OffsetPaths.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/OpenPathsFromPolyTree.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/Orientation.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/PointInPolygon.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/PolyTreeToPaths.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ReversePath.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ReversePaths.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/SimplifyPolygon.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/SimplifyPolygons.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/CInt.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/ClipType.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/EndType.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/InitOptions.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/IntPoint.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/IntRect.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/JoinType.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/Path.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/Paths.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/PolyFillType.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/PolyType.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/ZFillCallback.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/_Body.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Docs/_Body.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_BranchEmpty.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_BranchRight.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_BranchVert.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_BranchVertRight.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_Class.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_Home.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_Project_Logo.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_Unit.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/_buttons.gif
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/clean1.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/clean2.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/clipper_rounding.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/clipper_rounding2.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/clipper_rounding3.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/clipper_rounding4.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/cliptype.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/common_edges.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/difference.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/endtypes1.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/endtypes2.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/evenodd.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/int.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/intersection.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/jointypes.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/kangaroo_small.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/line_clipping.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/line_clipping2.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/linesdemo.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/minkowski.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/minkowski2.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/miterlimit.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/negative.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/nonzero.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/offset1.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/orientation.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/polytree.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/positive.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/sample1.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/simplify.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/simplify2.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/simplify3.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/union.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/winding_number.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/wn.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/xor.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Images/zfill.png
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/_theme_template.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/config.rb
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCore.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCoreDefault.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCoreDjango.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCoreEclipse.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCoreEmacs.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCoreFadeToGrey.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCoreMDUltra.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCoreMidnight.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shCoreRDark.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shThemeDefault.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shThemeDjango.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shThemeEclipse.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shThemeEmacs.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shThemeFadeToGrey.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shThemeMDUltra.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shThemeMidnight.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/compass/shThemeRDark.scss
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/index.html
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shAutoloader.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushAS3.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushAppleScript.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushBash.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushCSharp.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushColdFusion.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushCpp.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushCss.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushDelphi.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushDiff.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushErlang.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushGroovy.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushJScript.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushJava.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushJavaFX.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushPerl.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushPhp.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushPlain.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushPowerShell.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushPython.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushRuby.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushSass.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushScala.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushSql.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushVb.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shBrushXml.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shCore.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/scripts/shLegacy.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/src/shAutoloader.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/src/shCore.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/src/shLegacy.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCore.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCoreDefault.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCoreDjango.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCoreEclipse.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCoreEmacs.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCoreFadeToGrey.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCoreMDUltra.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCoreMidnight.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shCoreRDark.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shThemeDefault.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shThemeDjango.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shThemeEclipse.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shThemeEmacs.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shThemeFadeToGrey.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shThemeMDUltra.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shThemeMidnight.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/SyntaxHighlighter/styles/shThemeRDark.css
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/bootstrap.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/expandable.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/menu_data.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Scripts/menu_script.js
create mode 100644 upstream/clipper-6.4.2/Documentation/Styles/default.css
create mode 100644 upstream/clipper-6.4.2/Documentation/clipper.chm
create mode 100644 upstream/clipper-6.4.2/Documentation/default.css
create mode 100644 upstream/clipper-6.4.2/Documentation/index.htm
create mode 100644 upstream/clipper-6.4.2/Documentation/offset_triginometry.svg
create mode 100644 upstream/clipper-6.4.2/Documentation/offset_triginometry2.svg
create mode 100644 upstream/clipper-6.4.2/Documentation/offset_triginometry3.svg
create mode 100644 upstream/clipper-6.4.2/License.txt
create mode 100644 upstream/clipper-6.4.2/README
create mode 100644 upstream/clipper-6.4.2/cpp/CMakeLists.txt
create mode 100644 upstream/clipper-6.4.2/cpp/clipper.cpp
create mode 100644 upstream/clipper-6.4.2/cpp/clipper.hpp
create mode 100644 upstream/clipper-6.4.2/cpp/cpp_cairo/Cairo Resources.txt
create mode 100644 upstream/clipper-6.4.2/cpp/cpp_cairo/cairo.sln
create mode 100644 upstream/clipper-6.4.2/cpp/cpp_cairo/cairo.vcxproj
create mode 100644 upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.cpp
create mode 100644 upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.hpp
create mode 100644 upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.o
create mode 100644 upstream/clipper-6.4.2/cpp/cpp_cairo/libcairo-2.lib
create mode 100644 upstream/clipper-6.4.2/cpp/cpp_cairo/main.cpp
create mode 100644 upstream/clipper-6.4.2/cpp/polyclipping.pc.cmakein
create mode 160000 upstream/cpp-base64
create mode 160000 upstream/poisson-disk-sampling
create mode 160000 upstream/voronoi
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..378eac2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..01440f9
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,9 @@
+[submodule "upstream/cpp-base64"]
+ path = upstream/cpp-base64
+ url = https://github.com/ReneNyffenegger/cpp-base64
+[submodule "upstream/voronoi"]
+ path = upstream/voronoi
+ url = https://github.com/JCash/voronoi
+[submodule "upstream/poisson-disk-sampling"]
+ path = upstream/poisson-disk-sampling
+ url = https://github.com/thinks/poisson-disk-sampling
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..062c50e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,45 @@
+
+CXX := clang
+LD := ld
+PKG_CONFIG ?= pkg-config
+
+BUILDDIR ?= build
+
+SOURCES := src/svg_color.cpp \
+ src/svg_doc.cpp \
+ src/svg_geom.cpp \
+ src/svg_import_util.cpp \
+ src/svg_path.cpp \
+ src/svg_pattern.cpp \
+ src/vec_core.cpp \
+ src/vec_grid.cpp
+
+CLIPPER_SOURCES := upstream/clipper-6.4.2/cpp/clipper.cpp upstream/clipper-6.4.2/cpp/cpp_cairo/cairo_clipper.cpp
+CLIPPER_INCLUDES := -Iupstream/clipper-6.4.2/cpp -Iupstream/clipper-6.4.2/cpp/cpp_cairo/
+VORONOI_INCLUDES := -Iupstream/voronoi/src
+POISSON_INCLUDES := -Iupstream/poisson-disk-sampling/thinks/poisson_disk_sampling/
+BASE64_INCLUDES := -Iupstream/cpp-base64
+INCLUDES := $(CLIPPER_INCLUDES) $(VORONOI_INCLUDES) $(POISSON_INCLUDES) $(BASE64_INCLUDES)
+
+CXXFLAGS := -std=c++2a -g -Wall -Wextra
+CXXFLAGS += $(shell $(PKG_CONFIG) --cflags pangocairo pugixml opencv4)
+
+LDFLAGS := -lm -lc -lstdc++
+LDFLAGS += $(shell $(PKG_CONFIG) --libs pangocairo pugixml opencv4)
+
+all: $(BUILDDIR)/svg-render
+
+test.gbr test.svg &: render
+ ./render test.svg > test.gbr
+
+$(BUILDDIR)/%.o: %.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) -c $(CXXFLAGS) $(CXXFLAGS) $(INCLUDES) -o $@ $^
+
+$(BUILDDIR)/svg-render: $(SOURCES:%.cpp=$(BUILDDIR)/%.o) $(BUILDDIR)/upstream/cpp-base64/base64.o $(CLIPPER_SOURCES:.cpp=.o)
+ @mkdir -p $(dir $@)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+
+.PHONY: clean
+clean:
+ rm -rf $(BUILDDIR)
diff --git a/src/svg_color.cpp b/src/svg_color.cpp
new file mode 100644
index 0000000..acd793d
--- /dev/null
+++ b/src/svg_color.cpp
@@ -0,0 +1,125 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "svg_color.h"
+
+#include
+#include
+#include
+
+using namespace svg_plugin;
+using namespace std;
+
+/* Map an SVG fill or stroke definition (color, but may also be a pattern) to a gerber color.
+ *
+ * This function handles transparency: Transparent SVG colors are mapped such that no gerber output is generated for
+ * them.
+ */
+enum gerber_color svg_plugin::svg_color_to_gerber(string color, string opacity, enum gerber_color default_val) {
+ float alpha = 1.0;
+ if (!opacity.empty() && opacity[0] != '\0') {
+ char *endptr = nullptr;
+ alpha = strtof(opacity.data(), &endptr);
+ assert(endptr);
+ assert(*endptr == '\0');
+ }
+
+ if (alpha < 0.5f) {
+ return GRB_NONE;
+ }
+
+ if (color.empty()) {
+ return default_val;
+ }
+
+ if (color == "none") {
+ return GRB_NONE;
+ }
+
+ if (color.rfind("url(#", 0) != string::npos) {
+ return GRB_PATTERN_FILL;
+ }
+
+ if (color.length() == 7 && color[0] == '#') {
+ HSVColor hsv(color);
+ if (hsv.v >= 0.5) {
+ return GRB_CLEAR;
+ }
+ }
+
+ return GRB_DARK;
+}
+
+svg_plugin::RGBColor::RGBColor(string hex) {
+ assert(hex[0] == '#');
+ char *endptr = nullptr;
+ const char *c = hex.data();
+ int rgb = strtol(c + 1, &endptr, 16);
+ assert(endptr);
+ assert(endptr == c + 7);
+ assert(*endptr == '\0');
+ r = ((rgb >> 16) & 0xff) / 255.0f;
+ g = ((rgb >> 8) & 0xff) / 255.0f;
+ b = ((rgb >> 0) & 0xff) / 255.0f;
+};
+
+svg_plugin::HSVColor::HSVColor(const RGBColor &color) {
+ float xmax = fmax(color.r, fmax(color.g, color.b));
+ float xmin = fmin(color.r, fmin(color.g, color.b));
+ float c = xmax - xmin;
+
+ v = xmax;
+
+ if (c == 0)
+ h = 0;
+ else if (v == color.r)
+ h = 1/3 * (0 + (color.g - color.b) / c);
+ else if (v == color.g)
+ h = 1/3 * (2 + (color.b - color.r) / c);
+ else // v == color.b
+ h = 1/3 * (4 + (color.r - color.g) / c);
+
+ s = (v == 0) ? 0 : (c/v);
+}
+
+/* Invert gerber color */
+enum gerber_color svg_plugin::gerber_color_invert(enum gerber_color color) {
+ switch (color) {
+ case GRB_CLEAR: return GRB_DARK;
+ case GRB_DARK: return GRB_CLEAR;
+ default: return color; /* none, pattern */
+ }
+}
+
+/* Read node's fill attribute and convert it to a gerber color */
+enum gerber_color svg_plugin::gerber_fill_color(const pugi::xml_node &node) {
+ return svg_color_to_gerber(node.attribute("fill").value(), node.attribute("fill-opacity").value(), GRB_DARK);
+}
+
+/* Read node's stroke attribute and convert it to a gerber color */
+enum gerber_color svg_plugin::gerber_stroke_color(const pugi::xml_node &node) {
+ return svg_color_to_gerber(node.attribute("stroke").value(), node.attribute("stroke-opacity").value(), GRB_NONE);
+}
+
+
diff --git a/src/svg_color.h b/src/svg_color.h
new file mode 100644
index 0000000..5183dab
--- /dev/null
+++ b/src/svg_color.h
@@ -0,0 +1,59 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SVG_COLOR_H
+#define SVG_COLOR_H
+
+#include
+
+namespace svg_plugin {
+
+/* Enum that describes the color with which an SVG primite should be exported */
+enum gerber_color {
+ GRB_NONE = 0,
+ GRB_CLEAR,
+ GRB_DARK,
+ GRB_PATTERN_FILL,
+};
+
+class RGBColor {
+public:
+ float r, g, b;
+ RGBColor(std::string hex);
+};
+
+class HSVColor {
+public:
+ float h, s, v;
+ HSVColor(const RGBColor &color);
+};
+
+enum gerber_color svg_color_to_gerber(std::string color, std::string opacity, enum gerber_color default_val);
+enum gerber_color gerber_color_invert(enum gerber_color color);
+enum gerber_color gerber_fill_color(const pugi::xml_node &node);
+enum gerber_color gerber_stroke_color(const pugi::xml_node &node);
+
+} /* namespace svg_plugin */
+
+#endif /* SVG_COLOR_H */
diff --git a/src/svg_doc.cpp b/src/svg_doc.cpp
new file mode 100644
index 0000000..2543146
--- /dev/null
+++ b/src/svg_doc.cpp
@@ -0,0 +1,462 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "svg_import_defs.h"
+#include "svg_doc.h"
+#include "svg_color.h"
+#include "svg_geom.h"
+#include "svg_path.h"
+#include "vec_core.h"
+
+using namespace svg_plugin;
+using namespace std;
+using namespace ClipperLib;
+using namespace vectorizer;
+
+svg_plugin::SVGDocument::~SVGDocument() {
+ if (cr)
+ cairo_destroy (cr);
+ if (surface)
+ cairo_surface_destroy (surface);
+}
+
+bool svg_plugin::SVGDocument::load(string filename, string debug_out_filename) {
+ /* Load XML document */
+ auto res = svg_doc.load_file(filename.c_str());
+ if (!res) {
+ cerr << "Cannot open input file \"" << filename << "\": " << res << endl;
+ return false;
+ }
+
+ root_elem = svg_doc.child("svg");
+ if (!root_elem) {
+ cerr << "Cannot load input file \"" << filename << endl;
+ return false;
+ }
+
+ /* Set up the document's viewport transform */
+ istringstream vb_stream(root_elem.attribute("viewBox").value());
+ vb_stream >> vb_x >> vb_y >> vb_w >> vb_h;
+ cerr << "loaded viewbox: " << vb_x << ", " << vb_y << ", " << vb_w << ", " << vb_h << endl;
+
+ page_w = usvg_double_attr(root_elem, "width");
+ page_h = usvg_double_attr(root_elem, "height");
+ /* usvg resolves all units, but instead of outputting some reasonable absolute length like mm, it converts
+ * everything to px, which depends on usvg's DPI setting (--dpi).
+ */
+ page_w_mm = page_w / assumed_usvg_dpi * 25.4;
+ page_h_mm = page_h / assumed_usvg_dpi * 25.4;
+ if (!(page_w_mm > 0.0 && page_h_mm > 0.0 && page_w_mm < 10e3 && page_h_mm < 10e3)) {
+ cerr << "Warning: Page has zero or negative size, or is larger than 10 x 10 meters! Parsed size: " << page_w << " x " << page_h << " millimeter" << endl;
+ }
+
+ if (fabs((vb_w / page_w) / (vb_h / page_h) - 1.0) > 0.001) {
+ cerr << "Warning: Document has different document unit scale in x and y direction! Output will likely be garbage!" << endl;
+ }
+
+ /* Get the one document defs element */
+ defs_node = root_elem.child("defs");
+ if (!defs_node) {
+ cerr << "Warning: Input file is missing node" << endl;
+ }
+
+ setup_debug_output(debug_out_filename);
+ setup_viewport_clip();
+ load_clips();
+ load_patterns();
+
+ _valid = true;
+ return true;
+}
+
+const Paths *svg_plugin::SVGDocument::lookup_clip_path(const pugi::xml_node &node) {
+ string id(usvg_id_url(node.attribute("clip-path").value()));
+ if (id.empty() || !clip_path_map.contains(id)) {
+ return nullptr;
+ }
+ return &clip_path_map[id];
+}
+
+Pattern *svg_plugin::SVGDocument::lookup_pattern(const string id) {
+ if (id.empty() || !pattern_map.contains(id)) {
+ return nullptr;
+ }
+ return &pattern_map[id];
+};
+
+/* Used to convert mm values from configuration such as the minimum feature size into document units. */
+double svg_plugin::SVGDocument::mm_to_doc_units(double mm) const {
+ return mm * (vb_w / page_w_mm);
+}
+
+double svg_plugin::SVGDocument::doc_units_to_mm(double px) const {
+ return px / (vb_w / page_w_mm);
+}
+
+/* Recursively export all SVG elements in the given group. */
+void svg_plugin::SVGDocument::export_svg_group(const pugi::xml_node &group, Paths &parent_clip_path) {
+ /* Enter the group's coordinate system */
+ cairo_save(cr);
+ apply_cairo_transform_from_svg(cr, group.attribute("transform").value());
+
+ /* Fetch clip path from global registry and transform it into document coordinates. */
+ Paths clip_path;
+ auto *lookup = lookup_clip_path(group);
+ if (!lookup) {
+ string id(usvg_id_url(group.attribute("clip-path").value()));
+ if (!id.empty()) {
+ cerr << "Warning: Cannot find clip path with ID \"" << group.attribute("clip-path").value() << "\" for group \"" << group.attribute("id").value() << "\"." << endl;
+ }
+
+ } else {
+ clip_path = *lookup;
+ }
+ transform_paths(cr, clip_path);
+
+ /* Clip against parent's clip path (both are now in document coordinates) */
+ if (!parent_clip_path.empty()) {
+ if (!clip_path.empty()) {
+ cerr << "Combining clip paths" << endl;
+ combine_clip_paths(parent_clip_path, clip_path, clip_path);
+ } else {
+ cerr << "using parent clip path" << endl;
+ clip_path = parent_clip_path;
+ }
+ }
+
+ ClipperLib::Clipper c2;
+ c2.AddPaths(clip_path, ptSubject, /* closed */ true);
+ ClipperLib::IntRect bbox = c2.GetBounds();
+ cerr << "clip path is now: bbox={" << bbox.left << ", " << bbox.top << "} - {" << bbox.right << ", " << bbox.bottom << "}" << endl;
+
+ /* Iterate over the group's children, exporting them one by one. */
+ for (const auto &node : group.children()) {
+ string name(node.name());
+ if (name == "g") {
+ export_svg_group(node, clip_path);
+
+ } else if (name == "path") {
+ export_svg_path(node, clip_path);
+
+ } else if (name == "image") {
+ double min_feature_size_mm = 0.1; /* TODO make configurable */
+ double min_feature_size_px = mm_to_doc_units(min_feature_size_mm);
+ vectorize_image(cr, node, min_feature_size_px, clip_path, viewport_matrix);
+ } else if (name == "defs") {
+ /* ignore */
+ } else {
+ cerr << " Unexpected child: <" << node.name() << ">" << endl;
+ }
+ }
+
+ cairo_restore(cr);
+}
+
+/* Export an SVG path element to gerber. Apply patterns and clip on the fly. */
+void svg_plugin::SVGDocument::export_svg_path(const pugi::xml_node &node, Paths &clip_path) {
+ enum gerber_color fill_color = gerber_fill_color(node);
+ enum gerber_color stroke_color = gerber_stroke_color(node);
+
+ double stroke_width = usvg_double_attr(node, "stroke-width", /* default */ 1.0);
+ assert(stroke_width > 0.0);
+ enum ClipperLib::EndType end_type = clipper_end_type(node);
+ enum ClipperLib::JoinType join_type = clipper_join_type(node);
+ vector dasharray;
+ parse_dasharray(node, dasharray);
+ /* TODO add stroke-miterlimit */
+
+ if (!fill_color && !stroke_color) { /* Ignore "transparent" paths */
+ return;
+ }
+
+ /* Load path from SVG path data and transform into document units. */
+ PolyTree ptree;
+ cairo_save(cr);
+ apply_cairo_transform_from_svg(cr, node.attribute("transform").value());
+ load_svg_path(cr, node, ptree);
+ cairo_restore (cr);
+
+ Paths open_paths, closed_paths;
+ OpenPathsFromPolyTree(ptree, open_paths);
+ ClosedPathsFromPolyTree(ptree, closed_paths);
+
+ /* Skip filling for transparent fills */
+ if (fill_color) {
+ /* Clip paths. Consider all paths closed for filling. */
+ if (!clip_path.empty()) {
+ Clipper c;
+ c.AddPaths(open_paths, ptSubject, /* closed */ false);
+ c.AddPaths(closed_paths, ptSubject, /* closed */ true);
+ c.AddPaths(clip_path, ptClip, /* closed */ true);
+ c.StrictlySimple(true);
+ /* fill rules are nonzero since both subject and clip have already been normalized by clipper. */
+ c.Execute(ctIntersection, ptree, pftNonZero, pftNonZero);
+ }
+
+ /* Call out to pattern tiler for pattern fills. The path becomes the clip here. */
+ if (fill_color == GRB_PATTERN_FILL) {
+ string fill_pattern_id = usvg_id_url(node.attribute("fill").value());
+ Pattern *pattern = lookup_pattern(fill_pattern_id);
+ if (!pattern) {
+ cerr << "Warning: Fill pattern with id \"" << fill_pattern_id << "\" not found." << endl;
+
+ } else {
+ Paths clip;
+ PolyTreeToPaths(ptree, clip);
+ pattern->tile(clip);
+ }
+
+ } else { /* solid fill */
+ Paths f_polys;
+ /* Important for gerber spec compliance and also for reliable rendering results irrespective of board house
+ * and gerber viewer. */
+ dehole_polytree(ptree, f_polys);
+
+ /* Export SVG */
+ cairo_save(cr);
+ cairo_set_matrix(cr, &viewport_matrix);
+ cairo_new_path(cr);
+ ClipperLib::cairo::clipper_to_cairo(f_polys, cr, CAIRO_PRECISION, ClipperLib::cairo::tNone);
+ if (fill_color == GRB_DARK) {
+ cairo_set_source_rgba(cr, 0.0, 0.0, 1.0, dbg_fill_alpha);
+ } else { /* GRB_CLEAR */
+ cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, dbg_fill_alpha);
+ }
+ cairo_fill (cr);
+
+ /* export gerber */
+ cairo_identity_matrix(cr);
+ for (const auto &poly : f_polys) {
+ vector> out;
+ for (const auto &p : poly)
+ out.push_back(std::array{
+ ((double)p.X) / clipper_scale, ((double)p.Y) / clipper_scale
+ });
+ std::cerr << "calling sink" << std::endl;
+ polygon_sink(out, fill_color == GRB_DARK);
+ }
+ cairo_restore(cr);
+ }
+ }
+
+ if (stroke_color && stroke_width > 0.0) {
+ ClipperOffset offx;
+
+ /* For stroking we have to separately handle open and closed paths */
+ for (const auto &poly : closed_paths) {
+ if (poly.empty()) /* do we need this? */
+ continue;
+
+ /* Special case: A closed path becomes a number of open paths when it is dashed. */
+ if (dasharray.empty()) {
+ offx.AddPath(poly, join_type, etClosedLine);
+
+ } else {
+ Path poly_copy(poly);
+ poly_copy.push_back(poly[0]);
+ Paths out;
+ dash_path(poly_copy, out, dasharray);
+ offx.AddPaths(out, join_type, end_type);
+ }
+ }
+
+ for (const auto &poly : open_paths) {
+ Paths out;
+ dash_path(poly, out, dasharray);
+ offx.AddPaths(out, join_type, end_type);
+ }
+
+ /* Execute clipper offset operation to generate stroke outlines */
+ offx.Execute(ptree, 0.5 * stroke_width * clipper_scale);
+
+ /* Clip. Note that after the outline, all we have is closed paths as any open path's stroke outline is itself
+ * a closed path. */
+ if (!clip_path.empty()) {
+ Clipper c;
+
+ Paths outline_paths;
+ PolyTreeToPaths(ptree, outline_paths);
+ c.AddPaths(outline_paths, ptSubject, /* closed */ true);
+ c.AddPaths(clip_path, ptClip, /* closed */ true);
+ c.StrictlySimple(true);
+ /* fill rules are nonzero since both subject and clip have already been normalized by clipper. */
+ c.Execute(ctIntersection, ptree, pftNonZero, pftNonZero);
+ }
+
+ /* Call out to pattern tiler for pattern strokes. The stroke's outline becomes the clip here. */
+ if (stroke_color == GRB_PATTERN_FILL) {
+ string stroke_pattern_id = usvg_id_url(node.attribute("stroke").value());
+ Pattern *pattern = lookup_pattern(stroke_pattern_id);
+ if (!pattern) {
+ cerr << "Warning: Fill pattern with id \"" << stroke_pattern_id << "\" not found." << endl;
+
+ } else {
+ Paths clip;
+ PolyTreeToPaths(ptree, clip);
+ pattern->tile(clip);
+ }
+
+ } else {
+ Paths s_polys;
+ dehole_polytree(ptree, s_polys);
+
+ /* Export debug svg */
+ cairo_save(cr);
+ cairo_set_matrix(cr, &viewport_matrix);
+ cairo_new_path(cr);
+ ClipperLib::cairo::clipper_to_cairo(s_polys, cr, CAIRO_PRECISION, ClipperLib::cairo::tNone);
+ if (stroke_color == GRB_DARK) {
+ cairo_set_source_rgba(cr, 0.0, 0.0, 1.0, dbg_stroke_alpha);
+ } else { /* GRB_CLEAR */
+ cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, dbg_stroke_alpha);
+ }
+ cairo_fill (cr);
+
+ /* export gerber */
+ cairo_identity_matrix(cr);
+ for (const auto &poly : s_polys) {
+ vector> out;
+ for (const auto &p : poly)
+ out.push_back(std::array{
+ ((double)p.X) / clipper_scale, ((double)p.Y) / clipper_scale
+ });
+ std::cerr << "calling sink" << std::endl;
+ polygon_sink(out, stroke_color == GRB_DARK);
+ }
+ cairo_restore(cr);
+ }
+ }
+}
+
+void svg_plugin::SVGDocument::do_export(string debug_out_filename) {
+ assert(_valid);
+ /* Export the actual SVG document to both SVG for debuggin and to gerber. We do this as we go, i.e. we immediately
+ * process each element to gerber as we encounter it instead of first rendering everything to a giant list of gerber
+ * primitives and then serializing those later. Exporting them on the fly saves a ton of memory and is much faster.
+ */
+ ClipperLib::Clipper c;
+ c.AddPaths(vb_paths, ptSubject, /* closed */ true);
+ ClipperLib::IntRect bbox = c.GetBounds();
+ cerr << "document viewbox clip: bbox={" << bbox.left << ", " << bbox.top << "} - {" << bbox.right << ", " << bbox.bottom << "}" << endl;
+ export_svg_group(root_elem, vb_paths);
+}
+
+void svg_plugin::SVGDocument::setup_debug_output(string filename) {
+ /* Setup cairo to draw into a SVG surface (for debugging). For actual rendering, something like a recording surface
+ * would work fine, too. */
+ /* Cairo expects the SVG surface size to be given in pt (72.0 pt = 1.0 in = 25.4 mm) */
+ const char *fn = filename.empty() ? nullptr : filename.c_str();
+ assert (!cr);
+ assert (!surface);
+ surface = cairo_svg_surface_create(fn, page_w_mm / 25.4 * 72.0, page_h_mm / 25.4 * 72.0);
+ cr = cairo_create (surface);
+ /* usvg returns "pixels", cairo thinks we draw "points" at 72.0 pt per inch. */
+ cairo_scale(cr, page_w / vb_w * 72.0 / assumed_usvg_dpi, page_h / vb_h * 72.0 / assumed_usvg_dpi);
+
+ cairo_translate(cr, -vb_x, -vb_y);
+
+ /* Store viewport transform and reset cairo's active transform. We have to do this since we have to render out all
+ * gerber primitives in mm, not px and most gerber primitives we export pass through Cairo at some point.
+ *
+ * We manually apply this viewport transform every time for debugging we actually use Cairo to export SVG. */
+ cairo_get_matrix(cr, &viewport_matrix);
+ cairo_identity_matrix(cr);
+
+ cairo_set_line_width (cr, 0.1);
+ cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 1.0);
+}
+
+void svg_plugin::SVGDocument::setup_viewport_clip() {
+ /* Set up view port clip path */
+ Path vb_path;
+ for (auto &elem : vector> {{vb_x, vb_y}, {vb_x+vb_w, vb_y}, {vb_x+vb_w, vb_y+vb_h}, {vb_x, vb_y+vb_h}}) {
+ double x = elem.first, y = elem.second;
+ vb_path.push_back({ (cInt)round(x * clipper_scale), (cInt)round(y * clipper_scale) });
+ cerr << "adding to path: " << (cInt)round(x * clipper_scale) << ", " << (cInt)round(y * clipper_scale) << endl;
+ }
+ vb_paths.push_back(vb_path);
+
+ ClipperLib::Clipper c;
+ c.AddPaths(vb_paths, ptSubject, /* closed */ true);
+ ClipperLib::IntRect bbox = c.GetBounds();
+ cerr << "did set up viewbox clip: bbox={" << bbox.left << ", " << bbox.top << "} - {" << bbox.right << ", " << bbox.bottom << "}" << endl;
+ export_svg_group(root_elem, vb_paths);
+}
+
+void svg_plugin::SVGDocument::load_patterns() {
+ /* Set up document-wide pattern registry. Load patterns from node. */
+ for (const auto &node : defs_node.children("pattern")) {
+ pattern_map.emplace(std::piecewise_construct, std::forward_as_tuple(node.attribute("id").value()), std::forward_as_tuple(node, *this));
+ }
+}
+
+void svg_plugin::SVGDocument::load_clips() {
+ /* Set up document-wide clip path registry: Extract clip path definitions from element */
+ for (const auto &node : defs_node.children("clipPath")) {
+ cairo_save(cr);
+ apply_cairo_transform_from_svg(cr, node.attribute("transform").value());
+
+ string meta_clip_path_id(usvg_id_url(node.attribute("clip-path").value()));
+ Clipper c;
+
+ /* The clipPath node can only contain children. usvg converts all geometric objects (rect etc.) to
+ * s. Raster images are invalid inside a clip path. usvg removes all groups that are not relevant to
+ * rendering, and the only way a group might stay is if it affects rasterization (e.g. through mask, clipPath).
+ */
+ for (const auto &child : node.children("path")) {
+ PolyTree ptree;
+ cairo_save(cr);
+ /* TODO: we currently only support clipPathUnits="userSpaceOnUse", not "objectBoundingBox". */
+ apply_cairo_transform_from_svg(cr, child.attribute("transform").value());
+ load_svg_path(cr, child, ptree);
+ cairo_restore (cr);
+
+ Paths paths;
+ PolyTreeToPaths(ptree, paths);
+ c.AddPaths(paths, ptSubject, /* closed */ false);
+ }
+
+ /* Support clip paths that themselves have clip paths */
+ if (!meta_clip_path_id.empty()) {
+ if (clip_path_map.contains(meta_clip_path_id)) {
+ /* all clip paths must be closed */
+ c.AddPaths(clip_path_map[meta_clip_path_id], ptClip, /* closed */ true);
+
+ } else {
+ cerr << "Warning: Cannot find clip path with ID \"" << meta_clip_path_id << "\", ignoring." << endl;
+ }
+ }
+
+ PolyTree ptree;
+ c.StrictlySimple(true);
+ /* This unions all child s together and at the same time applies any meta clip path. */
+ /* The fill rules are both nonzero since both subject and clip have already been normalized by clipper. */
+ c.Execute(ctUnion, ptree, pftNonZero, pftNonZero);
+ /* Insert into document clip path map */
+ PolyTreeToPaths(ptree, clip_path_map[node.attribute("id").value()]);
+
+ cairo_restore(cr);
+ }
+}
+
diff --git a/src/svg_doc.h b/src/svg_doc.h
new file mode 100644
index 0000000..01a4e7a
--- /dev/null
+++ b/src/svg_doc.h
@@ -0,0 +1,97 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SVG_DOC_H
+#define SVG_DOC_H
+
+#include
+
+#include
+
+#include "svg_pattern.h"
+
+namespace svg_plugin {
+
+ typedef std::function>, bool)> polygon_sink_fun;
+
+ class SVGDocument {
+ public:
+ SVGDocument() : _valid(false) {}
+ SVGDocument(polygon_sink_fun sink_fun) : _valid(false), polygon_sink(sink_fun) {}
+ ~SVGDocument();
+
+ /* true -> load successful */
+ bool load(std::string filename, std::string debug_out_filename="/tmp/kicad_svg_debug.svg");
+ /* true -> load successful */
+ bool valid() const { return _valid; }
+ operator bool() const { return valid(); }
+
+ double mm_to_doc_units(double) const;
+ double doc_units_to_mm(double) const;
+
+ double width() const { return page_w_mm; }
+ double height() const { return page_h_mm; }
+
+ void do_export(std::string debug_out_filename="");
+
+ private:
+ friend class Pattern;
+
+ cairo_t *cairo() { return cr; }
+ const ClipperLib::Paths *lookup_clip_path(const pugi::xml_node &node);
+ Pattern *lookup_pattern(const std::string id);
+
+ void export_svg_group(const pugi::xml_node &group, ClipperLib::Paths &parent_clip_path);
+ void export_svg_path(const pugi::xml_node &node, ClipperLib::Paths &clip_path);
+ void setup_debug_output(std::string filename="");
+ void setup_viewport_clip();
+ void load_clips();
+ void load_patterns();
+
+ bool _valid;
+ pugi::xml_document svg_doc;
+ pugi::xml_node root_elem;
+ pugi::xml_node defs_node;
+ double vb_x, vb_y, vb_w, vb_h;
+ double page_w, page_h;
+ double page_w_mm, page_h_mm;
+ std::map pattern_map;
+ std::map clip_path_map;
+ cairo_matrix_t viewport_matrix;
+ ClipperLib::Paths vb_paths; /* viewport clip rect */
+
+ cairo_t *cr = nullptr;
+ cairo_surface_t *surface = nullptr;
+
+ polygon_sink_fun polygon_sink;
+
+ static constexpr double dbg_fill_alpha = 0.8;
+ static constexpr double dbg_stroke_alpha = 1.0;
+ static constexpr double assumed_usvg_dpi = 96.0;
+ };
+
+} /* namespace svg_plugin */
+
+#endif /* SVG_DOC_H */
+
diff --git a/src/svg_geom.cpp b/src/svg_geom.cpp
new file mode 100644
index 0000000..0e40e7b
--- /dev/null
+++ b/src/svg_geom.cpp
@@ -0,0 +1,181 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "svg_geom.h"
+
+#include
+#include
+#include
+#include
+#include
+#include "svg_import_defs.h"
+
+using namespace ClipperLib;
+using namespace std;
+
+/* Get bounding box of a Clipper Paths */
+IntRect svg_plugin::get_paths_bounds(const Paths &paths) {
+ if (paths.empty()) {
+ return {0, 0, 0, 0};
+ }
+
+ if (paths[0].empty()) {
+ return {0, 0, 0, 0};
+ }
+
+ IntPoint p0 = paths[0][0];
+ cInt x0=p0.X, y0=p0.Y, x1=p0.X, y1=p0.Y;
+
+ for (const Path &p : paths) {
+ for (const IntPoint ip : p) {
+ if (ip.X < x0)
+ x0 = ip.X;
+
+ if (ip.Y < y0)
+ y0 = ip.Y;
+
+ if (ip.X > x1)
+ x1 = ip.X;
+
+ if (ip.Y > y1)
+ y1 = ip.Y;
+ }
+ }
+
+ return {x0, y0, x1, y1};
+}
+
+enum ClipperLib::PolyFillType svg_plugin::clipper_fill_rule(const pugi::xml_node &node) {
+ string val(node.attribute("fill-rule").value());
+ if (val == "evenodd")
+ return ClipperLib::pftEvenOdd;
+ else
+ return ClipperLib::pftNonZero; /* default */
+}
+
+enum ClipperLib::EndType svg_plugin::clipper_end_type(const pugi::xml_node &node) {
+ string val(node.attribute("stroke-linecap").value());
+ if (val == "round")
+ return ClipperLib::etOpenRound;
+
+ if (val == "square")
+ return ClipperLib::etOpenSquare;
+
+ return ClipperLib::etOpenButt;
+}
+
+enum ClipperLib::JoinType svg_plugin::clipper_join_type(const pugi::xml_node &node) {
+ string val(node.attribute("stroke-linejoin").value());
+ if (val == "round")
+ return ClipperLib::jtRound;
+
+ if (val == "bevel")
+ return ClipperLib::jtSquare;
+
+ return ClipperLib::jtMiter;
+}
+
+/* Take a Clipper polytree, i.e. a description of a set of polygons, their holes and their inner polygons, and remove
+ * all holes from it. We remove holes by splitting each polygon that has a hole into two or more pieces so that the hole
+ * is no more. These pieces perfectly fit each other so there is no visual or functional difference.
+ */
+void svg_plugin::dehole_polytree(PolyNode &ptree, Paths &out) {
+ for (int i=0; iIsHole());
+
+ /* First, recursively process inner polygons. */
+ for (int j=0; jChildCount(); j++) {
+ PolyNode *child = nod->Childs[j];
+ assert(child);
+ assert(child->IsHole());
+
+ if (child->ChildCount() > 0) {
+ dehole_polytree(*child, out);
+ }
+ }
+
+ if (nod->ChildCount() == 0) {
+ out.push_back(nod->Contour);
+
+ } else {
+
+ /* Do not add children's children, those were handled in the recursive call above */
+ Clipper c;
+ c.AddPath(nod->Contour, ptSubject, /* closed= */ true);
+ for (int k=0; kChildCount(); k++) {
+ c.AddPath(nod->Childs[k]->Contour, ptSubject, /* closed= */ true);
+ }
+
+ /* Find a viable cut: Cut from top-left bounding box corner, through two subsequent points on the hole
+ * outline and to top-right bbox corner. */
+ IntRect bbox = c.GetBounds();
+ Path tri = { { bbox.left, bbox.top }, nod->Childs[0]->Contour[0], nod->Childs[0]->Contour[1], { bbox.right, bbox.top } };
+ c.AddPath(tri, ptClip, true);
+
+ PolyTree solution;
+ c.StrictlySimple(true);
+ /* Execute twice, once for intersection fragment and once for difference fragment. Note that this will yield
+ * at least two, but possibly more polygons. */
+ c.Execute(ctDifference, solution, pftNonZero);
+ dehole_polytree(solution, out);
+
+ c.Execute(ctIntersection, solution, pftNonZero);
+ dehole_polytree(solution, out);
+ }
+ }
+}
+
+/* Intersect two clip paths. Both must share a coordinate system. */
+void svg_plugin::combine_clip_paths(Paths &in_a, Paths &in_b, Paths &out) {
+ Clipper c;
+ c.StrictlySimple(true);
+ c.AddPaths(in_a, ptClip, /* closed */ true);
+ c.AddPaths(in_b, ptSubject, /* closed */ true);
+ /* Nonzero fill since both input clip paths must already have been preprocessed by clipper. */
+ c.Execute(ctIntersection, out, pftNonZero);
+}
+
+/* Transform given clipper paths under the given cairo transform. If no transform is given, use cairo's current
+ * user-to-device transform. */
+void svg_plugin::transform_paths(cairo_t *cr, Paths &paths, cairo_matrix_t *mat) {
+ cairo_save(cr);
+ if (mat != nullptr) {
+ cairo_set_matrix(cr, mat);
+ }
+
+ for (Path &p : paths) {
+ transform(p.begin(), p.end(), p.begin(),
+ [cr](IntPoint p) -> IntPoint {
+ double x = p.X / clipper_scale, y = p.Y / clipper_scale;
+ cairo_user_to_device(cr, &x, &y);
+ return { (cInt)round(x * clipper_scale), (cInt)round(y * clipper_scale) };
+ });
+ }
+
+ cairo_restore(cr);
+}
+
+
diff --git a/src/svg_geom.h b/src/svg_geom.h
new file mode 100644
index 0000000..dfd1c80
--- /dev/null
+++ b/src/svg_geom.h
@@ -0,0 +1,44 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SVG_GEOM_H
+#define SVG_GEOM_H
+
+#include
+#include
+#include
+
+namespace svg_plugin {
+
+ClipperLib::IntRect get_paths_bounds(const ClipperLib::Paths &paths);
+enum ClipperLib::PolyFillType clipper_fill_rule(const pugi::xml_node &node);
+enum ClipperLib::EndType clipper_end_type(const pugi::xml_node &node);
+enum ClipperLib::JoinType clipper_join_type(const pugi::xml_node &node);
+void dehole_polytree(ClipperLib::PolyNode &ptree, ClipperLib::Paths &out);
+void combine_clip_paths(ClipperLib::Paths &in_a, ClipperLib::Paths &in_b, ClipperLib::Paths &out);
+void transform_paths(cairo_t *cr, ClipperLib::Paths &paths, cairo_matrix_t *mat=nullptr);
+
+} /* namespace svg_plugin */
+
+#endif /* SVG_GEOM_H */
diff --git a/src/svg_import_defs.h b/src/svg_import_defs.h
new file mode 100644
index 0000000..e25c52c
--- /dev/null
+++ b/src/svg_import_defs.h
@@ -0,0 +1,49 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2016 CERN
+ * @author Janito V. Ferreira Filho
+ * Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SVG_IMPORT_DEFS_H
+#define SVG_IMPORT_DEFS_H
+
+#include
+
+template
+constexpr T ipow(T num, unsigned int pow)
+{
+ return (pow >= sizeof(unsigned int)*8) ? 0 :
+ pow == 0 ? 1 : num * ipow(num, pow-1);
+}
+
+constexpr int CAIRO_PRECISION = 7;
+constexpr double clipper_scale = ipow(10.0, CAIRO_PRECISION);
+
+#define JC_VORONOI_IMPLEMENTATION
+#define JCV_REAL_TYPE double
+#define JCV_ATAN2 atan2
+#define JCV_SQRT sqrt
+#define JCV_FLT_MAX DBL_MAX
+#define JCV_PI 3.141592653589793115997963468544185161590576171875
+//define JCV_EDGE_INTERSECT_THRESHOLD 1.0e-10F
+
+#endif /* SVG_IMPORT_DEFS_H */
diff --git a/src/svg_import_util.cpp b/src/svg_import_util.cpp
new file mode 100644
index 0000000..5624bd9
--- /dev/null
+++ b/src/svg_import_util.cpp
@@ -0,0 +1,129 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include
+#include "base64.h"
+#include "svg_import_util.h"
+
+using namespace std;
+
+void svg_plugin::print_matrix(cairo_t *cr, bool print_examples) {
+ cairo_matrix_t mat;
+ cairo_get_matrix(cr, &mat);
+ cerr << " xform matrix = { xx=" << mat.xx << ", yx=" << mat.yx << ", xy=" << mat.xy << ", yy=" << mat.yy << ", x0=" << mat.x0 << ", y0=" << mat.y0 << " }" << endl;
+ if (print_examples) {
+ double x=0, y=0;
+ cairo_user_to_device(cr, &x, &y);
+ cerr << " (0, 0) -> (" << x << ", " << y << ")" << endl;
+ x = 1, y = 0;
+ cairo_user_to_device(cr, &x, &y);
+ cerr << " (1, 0) -> (" << x << ", " << y << ")" << endl;
+ x = 0, y = 1;
+ cairo_user_to_device(cr, &x, &y);
+ cerr << " (0, 1) -> (" << x << ", " << y << ")" << endl;
+ x = 1, y = 1;
+ cairo_user_to_device(cr, &x, &y);
+ cerr << " (1, 1) -> (" << x << ", " << y << ")" << endl;
+ }
+}
+
+/* Read a double value formatted like usvg formats doubles from an SVG attribute */
+double svg_plugin::usvg_double_attr(const pugi::xml_node &node, const char *attr, double default_value) {
+ const auto *val = node.attribute(attr).value();
+ if (*val == '\0')
+ return default_value;
+
+ return atof(val);
+}
+
+/* Read an url from an usvg attribute */
+string svg_plugin::usvg_id_url(string attr) {
+ if (attr.rfind("url(#", 0) == string::npos)
+ return string();
+
+ attr = attr.substr(strlen("url(#"));
+ attr = attr.substr(0, attr.size()-1);
+ return attr;
+}
+
+svg_plugin::RelativeUnits svg_plugin::map_str_to_units(string str, svg_plugin::RelativeUnits default_val) {
+ if (str == "objectBoundingBox")
+ return SVG_ObjectBoundingBox;
+ else if (str == "userSpaceOnUse")
+ return SVG_UserSpaceOnUse;
+ return default_val;
+}
+
+void svg_plugin::load_cairo_matrix_from_svg(const string &transform, cairo_matrix_t &mat) {
+ if (transform.empty()) {
+ cairo_matrix_init_identity(&mat);
+ return;
+ }
+
+ string start("matrix(");
+ assert(transform.substr(0, start.length()) == start);
+ assert(transform.back() == ')');
+ const string &foo = transform.substr(start.length(), transform.length());
+ const string &bar = foo.substr(0, foo.length() - 1);
+
+ istringstream xform(bar);
+
+ double a, c, e,
+ b, d, f;
+ xform >> a >> b >> c >> d >> e >> f;
+ assert(!xform.fail());
+
+ cairo_matrix_init(&mat, a, b, c, d, e, f);
+}
+
+void svg_plugin::apply_cairo_transform_from_svg(cairo_t *cr, const string &transform) {
+ cairo_matrix_t mat;
+ load_cairo_matrix_from_svg(transform, mat);
+ cairo_transform(cr, &mat); /* or cairo_transform? */
+}
+
+/* Cf. https://tools.ietf.org/html/rfc2397 */
+string svg_plugin::parse_data_iri(const string &data_url) {
+ if (data_url.rfind("data:", 0) == string::npos) /* check if url starts with "data:" */
+ return string();
+
+ size_t foo = data_url.find("base64,");
+ if (foo == string::npos) /* check if this is actually a data URL */
+ return string();
+
+ size_t b64_begin = data_url.find_first_not_of(" ", foo + strlen("base64,"));
+ assert(b64_begin != string::npos);
+
+ return base64_decode(data_url.substr(b64_begin));
+}
+
+/* for debug svg output */
+void svg_plugin::apply_viewport_matrix(cairo_t *cr, cairo_matrix_t &viewport_matrix) {
+ /* Multiply viewport matrix *from the left*, i.e. as if it had been applied *before* the currently set matrix. */
+ cairo_matrix_t old_matrix;
+ cairo_get_matrix(cr, &old_matrix);
+ cairo_set_matrix(cr, &viewport_matrix);
+ cairo_transform(cr, &old_matrix);
+}
+
diff --git a/src/svg_import_util.h b/src/svg_import_util.h
new file mode 100644
index 0000000..8485957
--- /dev/null
+++ b/src/svg_import_util.h
@@ -0,0 +1,69 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SVG_IMPORT_UTIL_H
+#define SVG_IMPORT_UTIL_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include "cairo_clipper.hpp"
+
+#include
+
+#include "svg_import_defs.h"
+
+namespace svg_plugin {
+
+/* Coordinate system selection for things like "patternContentUnits" */
+enum RelativeUnits {
+ SVG_UnknownUnits = 0,
+ SVG_UserSpaceOnUse,
+ SVG_ObjectBoundingBox,
+};
+
+void print_matrix(cairo_t *cr, bool print_examples=false);
+double usvg_double_attr(const pugi::xml_node &node, const char *attr, double default_value=0.0);
+std::string usvg_id_url(std::string attr);
+RelativeUnits map_str_to_units(std::string str, RelativeUnits default_val=SVG_UnknownUnits);
+void load_cairo_matrix_from_svg(const std::string &transform, cairo_matrix_t &mat);
+void apply_cairo_transform_from_svg(cairo_t *cr, const std::string &transform);
+std::string parse_data_iri(const std::string &data_url);
+void apply_viewport_matrix(cairo_t *cr, cairo_matrix_t &viewport_matrix);
+
+} /* namespace svg_plugin */
+
+#endif /* SVG_IMPORT_UTIL_H */
diff --git a/src/svg_path.cpp b/src/svg_path.cpp
new file mode 100644
index 0000000..9137e1a
--- /dev/null
+++ b/src/svg_path.cpp
@@ -0,0 +1,219 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include
+#include
+#include
+#include
+#include "cairo_clipper.hpp"
+#include "svg_import_defs.h"
+#include "svg_path.h"
+
+using namespace std;
+
+static void clipper_add_cairo_path(cairo_t *cr, ClipperLib::Clipper &c, bool closed) {
+ ClipperLib::Paths in_poly;
+ ClipperLib::cairo::cairo_to_clipper(cr, in_poly, CAIRO_PRECISION, ClipperLib::cairo::tNone);
+ c.AddPaths(in_poly, ClipperLib::ptSubject, closed);
+}
+
+static void path_to_clipper_via_cairo(cairo_t *cr, ClipperLib::Clipper &c, const pugi::char_t *path_data) {
+ istringstream d(path_data);
+
+ string cmd;
+ double x, y, c1x, c1y, c2x, c2y;
+
+ bool first = true;
+ bool path_is_empty = true;
+ while (!d.eof()) {
+ d >> cmd;
+ assert (!d.fail());
+ assert(!first || cmd == "M");
+
+ if (cmd == "Z") { /* Close path */
+ cairo_close_path(cr);
+ clipper_add_cairo_path(cr, c, /* closed= */ true);
+ cairo_new_path(cr);
+ path_is_empty = true;
+
+ } else if (cmd == "M") { /* Move to */
+ d >> x >> y;
+ /* We need to transform all points ourselves here, and cannot use the transform feature of cairo_to_clipper:
+ * Our transform may contain offsets, and clipper only passes its data into cairo's transform functions
+ * after scaling up to its internal fixed-point ints, but it does not scale the transform accordingly. This
+ * means a scale/rotation we set before calling clipper works out fine, but translations get lost as they
+ * get scaled by something like 1e-6.
+ */
+ cairo_user_to_device(cr, &x, &y);
+ assert (!d.fail());
+ if (!first)
+ clipper_add_cairo_path(cr, c, /* closed= */ false);
+ cairo_new_path (cr);
+ path_is_empty = true;
+ cairo_move_to(cr, x, y);
+
+ } else if (cmd == "L") { /* Line to */
+ d >> x >> y;
+ cairo_user_to_device(cr, &x, &y);
+ assert (!d.fail());
+ cairo_line_to(cr, x, y);
+ path_is_empty = false;
+
+ } else { /* Curve to */
+ assert(cmd == "C");
+ d >> c1x >> c1y; /* first control point */
+ cairo_user_to_device(cr, &c1x, &c1y);
+ d >> c2x >> c2y; /* second control point */
+ cairo_user_to_device(cr, &c2x, &c2y);
+ d >> x >> y; /* end point */
+ cairo_user_to_device(cr, &x, &y);
+ assert (!d.fail());
+ cairo_curve_to(cr, c1x, c1y, c2x, c2y, x, y);
+ path_is_empty = false;
+ }
+
+ first = false;
+ }
+ if (!path_is_empty) {
+ cairo_close_path(cr);
+ clipper_add_cairo_path(cr, c, /* closed= */ false);
+ }
+}
+
+void svg_plugin::load_svg_path(cairo_t *cr, const pugi::xml_node &node, ClipperLib::PolyTree &ptree) {
+ auto *path_data = node.attribute("d").value();
+ auto fill_rule = clipper_fill_rule(node);
+
+ /* For open paths, clipper does not correctly remove self-intersections. Thus, we pass everything into
+ * clipper twice: Once with all paths set to "closed" to compute fill areas, and once with correct
+ * open/closed properties for stroke offsetting. */
+ cairo_set_tolerance (cr, 0.1); /* FIXME make configurable, scale properly for units */
+ cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING);
+
+ ClipperLib::Clipper c;
+ c.StrictlySimple(true);
+ path_to_clipper_via_cairo(cr, c, path_data);
+ /* We canont clip the polygon here since that would produce incorrect results for our stroke. */
+ c.Execute(ClipperLib::ctUnion, ptree, fill_rule, ClipperLib::pftNonZero);
+}
+
+void svg_plugin::parse_dasharray(const pugi::xml_node &node, vector &out) {
+ out.clear();
+
+ string val(node.attribute("stroke-dasharray").value());
+ if (val.empty() || val == "none")
+ return;
+
+ istringstream desc_stream(val);
+ while (!desc_stream.eof()) {
+ /* usvg says the array only contains unitless (px) values. I don't know what resvg does with percentages inside
+ * dash arrays. We just assume everything is a unitless number here. In case usvg passes through percentages,
+ * well, bad luck. They are a kind of weird thing inside a dash array in the first place. */
+ double d;
+ desc_stream >> d;
+ out.push_back(d);
+ }
+
+ assert(out.size() % 2 == 0); /* according to resvg spec */
+}
+
+/* Take a Clipper path in clipper-scaled document units, and apply the given SVG dash array to it. Do this by walking
+ * the path from start to end while emitting dashes. */
+void svg_plugin::dash_path(const ClipperLib::Path &in, ClipperLib::Paths &out, const vector dasharray, double dash_offset) {
+ out.clear();
+ if (dasharray.empty() || in.size() < 2) {
+ out.push_back(in);
+ return;
+ }
+
+ size_t dash_idx = 0;
+ size_t num_dashes = dasharray.size();
+ while (dash_offset > dasharray[dash_idx]) {
+ dash_offset -= dasharray[dash_idx];
+ dash_idx = (dash_idx + 1) % num_dashes;
+ }
+
+ double dash_remaining = dasharray[dash_idx] - dash_offset;
+
+ ClipperLib::Path current_dash;
+ current_dash.push_back(in[0]);
+ double dbg_total_len = 0.0;
+ for (size_t i=1; i dasharray[dash_idx]) {
+ offset += dasharray[dash_idx];
+
+ double dash_frac = offset/dist;
+ double x = x1 + (x2 - x1) * dash_frac,
+ y = y1 + (y2 - y1) * dash_frac;
+ ClipperLib::IntPoint intermediate {(ClipperLib::cInt)round(x * clipper_scale), (ClipperLib::cInt)round(y * clipper_scale)};
+
+ /* end this dash */
+ current_dash.push_back(intermediate);
+ if (dash_idx%2 == 0) { /* dash */
+ out.push_back(current_dash);
+ } /* else space */
+ dash_idx = (dash_idx + 1) % num_dashes;
+
+ /* start next dash */
+ current_dash.clear();
+ current_dash.push_back(intermediate);
+ }
+
+ dash_remaining = dasharray[dash_idx] - (dist - offset);
+ current_dash.push_back(p2);
+ }
+ }
+}
+
diff --git a/src/svg_path.h b/src/svg_path.h
new file mode 100644
index 0000000..0a527f6
--- /dev/null
+++ b/src/svg_path.h
@@ -0,0 +1,38 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SVG_PATH_H
+#define SVG_PATH_H
+
+#include
+#include
+#include "svg_geom.h"
+
+namespace svg_plugin {
+void load_svg_path(cairo_t *cr, const pugi::xml_node &node, ClipperLib::PolyTree &ptree);
+void parse_dasharray(const pugi::xml_node &node, std::vector &out);
+void dash_path(const ClipperLib::Path &in, ClipperLib::Paths &out, const std::vector dasharray, double dash_offset=0.0);
+}
+
+#endif /* SVG_PATH_H */
diff --git a/src/svg_pattern.cpp b/src/svg_pattern.cpp
new file mode 100644
index 0000000..8ca6572
--- /dev/null
+++ b/src/svg_pattern.cpp
@@ -0,0 +1,119 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include
+#include "svg_import_util.h"
+#include "svg_pattern.h"
+#include "svg_import_defs.h"
+#include "svg_geom.h"
+#include "svg_doc.h"
+
+using namespace std;
+
+svg_plugin::Pattern::Pattern(const pugi::xml_node &node, SVGDocument &doc) : _node(node), doc(&doc) {
+ /* Read pattern attributes from SVG node */
+ cerr << "creating pattern for node with id \"" << node.attribute("id").value() << "\"" << endl;
+ x = usvg_double_attr(node, "x");
+ y = usvg_double_attr(node, "y");
+ w = usvg_double_attr(node, "width");
+ h = usvg_double_attr(node, "height");
+ patternTransform = node.attribute("patternTransform").value();
+
+ string vb_s(node.attribute("viewBox").value());
+ has_vb = !vb_s.empty();
+ if (has_vb) {
+ istringstream vb_stream(vb_s);
+ vb_stream >> vb_x >> vb_y >> vb_w >> vb_h;
+ }
+
+ patternUnits = map_str_to_units(node.attribute("patternUnits").value(), SVG_ObjectBoundingBox);
+ patternContentUnits = map_str_to_units(node.attribute("patternContentUnits").value(), SVG_UserSpaceOnUse);
+}
+
+/* Tile pattern into gerber. Note that this function may be called several times in case the pattern is
+ * referenced from multiple places, so we must not clobber any of the object's state. */
+void svg_plugin::Pattern::tile (ClipperLib::Paths &clip) {
+ assert(doc);
+ cairo_t *cr = doc->cairo();
+ assert(cr);
+
+ cairo_save(cr);
+ /* Transform x, y, w, h from pattern coordinate space into parent coordinates by applying the inverse
+ * patternTransform. This is necessary so we iterate over the correct bounds when tiling below */
+ cairo_matrix_t mat;
+ load_cairo_matrix_from_svg(patternTransform, mat);
+ if (cairo_matrix_invert(&mat) != CAIRO_STATUS_SUCCESS) {
+ cerr << "Cannot invert patternTransform matrix on pattern \"" << _node.attribute("id").value() << "\"." << endl;
+ cairo_restore(cr);
+ }
+ double inst_x = x, inst_y = y, inst_w = w, inst_h = h;
+ cairo_user_to_device(cr, &inst_x, &inst_y);
+ cairo_user_to_device_distance(cr, &inst_w, &inst_h);
+ cairo_restore(cr);
+
+ ClipperLib::IntRect clip_bounds = get_paths_bounds(clip);
+ double bx = clip_bounds.left / clipper_scale;
+ double by = clip_bounds.top / clipper_scale;
+ double bw = (clip_bounds.right - clip_bounds.left) / clipper_scale;
+ double bh = (clip_bounds.bottom - clip_bounds.top) / clipper_scale;
+
+ if (patternUnits == SVG_ObjectBoundingBox) {
+ inst_x *= bw;
+ inst_y *= bh;
+ inst_w *= bw;
+ inst_h *= bh;
+ }
+
+ /* Switch to pattern coordinates */
+ cairo_save(cr);
+ cairo_translate(cr, bx, by);
+ apply_cairo_transform_from_svg(cr, patternTransform);
+
+ /* Iterate over all pattern tiles in pattern coordinates */
+ for (double inst_off_x = fmod(inst_x, inst_w) - inst_w;
+ inst_off_x < bw + inst_w;
+ inst_off_x += inst_w) {
+
+ for (double inst_off_y = fmod(inst_y, inst_h) - inst_h;
+ inst_off_y < bh + inst_h;
+ inst_off_y += inst_h) {
+
+ cairo_save(cr);
+ /* Change into this individual tile's coordinate system */
+ cairo_translate(cr, inst_off_x, inst_off_y);
+ if (has_vb) {
+ cairo_translate(cr, vb_x, vb_y);
+ cairo_scale(cr, inst_w / vb_w, inst_h / vb_h);
+ } else if (patternContentUnits == SVG_ObjectBoundingBox) {
+ cairo_scale(cr, bw, bh);
+ }
+
+ /* Export the pattern tile's content like a group */
+ doc->export_svg_group(_node, clip);
+ cairo_restore(cr);
+ }
+ }
+ cairo_restore(cr);
+}
+
diff --git a/src/svg_pattern.h b/src/svg_pattern.h
new file mode 100644
index 0000000..e11fde5
--- /dev/null
+++ b/src/svg_pattern.h
@@ -0,0 +1,60 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef SVG_PATTERN_H
+#define SVG_PATTERN_H
+
+#include
+#include
+
+#include
+#include
+
+#include "svg_import_util.h"
+
+namespace svg_plugin {
+
+class SVGDocument;
+
+class Pattern {
+public:
+ Pattern() {}
+ Pattern(const pugi::xml_node &node, SVGDocument &doc);
+
+ void tile (ClipperLib::Paths &clip);
+
+private:
+ double x, y, w, h;
+ double vb_x, vb_y, vb_w, vb_h;
+ bool has_vb;
+ std::string patternTransform;
+ enum RelativeUnits patternUnits;
+ enum RelativeUnits patternContentUnits;
+ const pugi::xml_node _node;
+ SVGDocument *doc = nullptr;
+};
+
+} /* namespace svg_plugin */
+
+#endif /* SVG_PATTERN_H */
diff --git a/src/vec_core.cpp b/src/vec_core.cpp
new file mode 100644
index 0000000..0c60c7d
--- /dev/null
+++ b/src/vec_core.cpp
@@ -0,0 +1,339 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include "svg_import_util.h"
+#include "vec_core.h"
+#include "svg_import_defs.h"
+#include "jc_voronoi.h"
+
+using namespace svg_plugin;
+using namespace std;
+
+/* debug function */
+static void dbg_show_cv_image(cv::Mat &img) {
+ string windowName = "Debug image";
+ cv::namedWindow(windowName);
+ cv::imshow(windowName, img);
+ cv::waitKey(0);
+ cv::destroyWindow(windowName);
+}
+
+/* From jcv voronoi README */
+static void voronoi_relax_points(const jcv_diagram* diagram, jcv_point* points) {
+ const jcv_site* sites = jcv_diagram_get_sites(diagram);
+ for (int i=0; inumsites; i++) {
+ const jcv_site* site = &sites[i];
+ jcv_point sum = site->p;
+ int count = 1;
+
+ const jcv_graphedge* edge = site->edges;
+
+ while (edge) {
+ sum.x += edge->pos[0].x;
+ sum.y += edge->pos[0].y;
+ count++;
+ edge = edge->next;
+ }
+
+ points[site->index].x = sum.x / count;
+ points[site->index].y = sum.y / count;
+ }
+}
+
+/* Render image into gerber file.
+ *
+ * This function renders an image into a number of vector primitives emulating the images grayscale brightness by
+ * differently sized vector shaped giving an effect similar to halftone printing used in newspapers.
+ *
+ * On a high level, this function does this in four steps:
+ * 1. It preprocesses the source image at the pixel level. This involves several tasks:
+ * 1.1. It converts the image to grayscale.
+ * 1.2. It scales the image up or down to match the given minimum feature size.
+ * 1.3. It applies a blur depending on the given minimum feature size to prevent aliasing artifacts.
+ * 2. It randomly spread points across the image using poisson disc sampling. This yields points that have a fairly even
+ * average distance to each other across the image, and that have a guaranteed minimum distance that depends on
+ * minimum feature size.
+ * 3. It calculates a voronoi map based on this set of points and it calculats the polygon shape of each cell of the
+ * voronoi map.
+ * 4. It scales each of these voronoi cell polygons to match the input images brightness at the spot covered by this
+ * cell.
+ */
+void vectorizer::vectorize_image(cairo_t *cr, const pugi::xml_node &node, double min_feature_size_px, ClipperLib::Paths &clip_path, cairo_matrix_t &viewport_matrix) {
+ /* Read XML node attributes */
+ auto x = usvg_double_attr(node, "x", 0.0);
+ auto y = usvg_double_attr(node, "y", 0.0);
+ auto width = usvg_double_attr(node, "width", 0.0);
+ auto height = usvg_double_attr(node, "height", 0.0);
+ assert (width > 0 && height > 0);
+ cerr << "image elem: w="< img_vec(img_data.begin(), img_data.end());
+ cv::Mat data_mat(img_vec, true);
+ cv::Mat img = cv::imdecode(data_mat, cv::ImreadModes::IMREAD_GRAYSCALE | cv::ImreadModes::IMREAD_ANYDEPTH);
+ data_mat.release();
+
+ if (img.empty()) {
+ cerr << "Warning: Could not decode content of image element with id \"" << node.attribute("id").value() << "\"" << endl;
+ return;
+ }
+
+ /* Set up target transform using SVG transform and x/y attributes */
+ cairo_save(cr);
+ apply_cairo_transform_from_svg(cr, node.attribute("transform").value());
+ cairo_translate(cr, x, y);
+
+ /* Adjust minimum feature size given in mm and translate into px document units in our local coordinate system. */
+ double f_x = min_feature_size_px, f_y = 0;
+ cairo_device_to_user_distance(cr, &f_x, &f_y);
+ min_feature_size_px = sqrt(f_x*f_x + f_y*f_y);
+
+ /* For both our debug SVG output and for the gerber output, we have to paint the image's bounding box in black as
+ * background for our halftone blobs. We cannot simply draw a rect here, though. Instead we have to first intersect
+ * the bounding box with the clip path we get from the caller, then we have to translate it into Cairo-SVG's
+ * document units. */
+ /* First, setup the bounding box rectangle in our local px coordinate space. */
+ ClipperLib::Path rect_path;
+ for (auto &elem : vector> {{0, 0}, {width, 0}, {width, height}, {0, height}}) {
+ double x = elem.first, y = elem.second;
+ cairo_user_to_device(cr, &x, &y);
+ rect_path.push_back({ (ClipperLib::cInt)round(x * clipper_scale), (ClipperLib::cInt)round(y * clipper_scale) });
+ }
+
+ /* Intersect the bounding box with the caller's clip path */
+ ClipperLib::Clipper c;
+ c.AddPath(rect_path, ClipperLib::ptSubject, /* closed */ true);
+ if (!clip_path.empty()) {
+ c.AddPaths(clip_path, ClipperLib::ptClip, /* closed */ true);
+ }
+
+ ClipperLib::Paths rect_out;
+ c.StrictlySimple(true);
+ c.Execute(ClipperLib::ctIntersection, rect_out, ClipperLib::pftNonZero, ClipperLib::pftNonZero);
+
+ /* Finally, translate into Cairo-SVG's document units and draw. */
+ cairo_save(cr);
+ cairo_set_matrix(cr, &viewport_matrix);
+ cairo_new_path(cr);
+ ClipperLib::cairo::clipper_to_cairo(rect_out, cr, CAIRO_PRECISION, ClipperLib::cairo::tNone);
+ cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
+ /* First, draw into SVG */
+ cairo_fill(cr);
+ cairo_restore(cr);
+
+ /* Second, draw into gerber. */
+ cairo_save(cr);
+ cairo_identity_matrix(cr);
+ for (const auto &poly : rect_out) {
+ /* FIXME */
+ //export_as_gerber(cr, poly, /* dark */ false);
+ }
+ cairo_restore(cr);
+
+ /* Set up a poisson-disc sampled point "grid" covering the image. Calculate poisson disc parameters from given
+ * minimum feature size. */
+ double grayscale_overhead = 0.8; /* fraction of distance between two adjacent cell centers that is reserved for
+ grayscale interpolation. Larger values -> better grayscale resolution,
+ larger cells. */
+ double center_distance = min_feature_size_px * 2.0 * (1.0 / (1.0-grayscale_overhead));
+ vector *grid_centers = sample_poisson_disc(width, height, min_feature_size_px * 2.0 * 2.0);
+ /* TODO make these alternative grids available to callers */
+ //vector *grid_centers = sample_hexgrid(width, height, center_distance);
+ //vector *grid_centers = sample_squaregrid(width, height, center_distance);
+
+ /* Target factor between given min_feature_size and intermediate image pixels,
+ * i.e. px ^= min_feature_size */
+ double scale_featuresize_factor = 3.0;
+ /* TODO: support for preserveAspectRatio attribute */
+ double px_w = width / min_feature_size_px * scale_featuresize_factor;
+ double px_h = height / min_feature_size_px * scale_featuresize_factor;
+
+ /* Scale intermediate image (step 1.2) to have pixels per min_feature_size. */
+ cv::Mat scaled(cv::Size{(int)round(px_w), (int)round(px_h)}, img.type());
+ cv::resize(img, scaled, scaled.size(), 0, 0);
+ img.release();
+
+ /* Blur image with a kernel larger than our minimum feature size to avoid aliasing. */
+ cv::Mat blurred(scaled.size(), scaled.type());
+ int blur_size = (int)ceil(fmax(scaled.cols / width, scaled.rows / height) * center_distance);
+ cv::GaussianBlur(scaled, blurred, {blur_size, blur_size}, 0, 0);
+ scaled.release();
+
+ /* Calculate voronoi diagram for the grid generated above. */
+ jcv_diagram diagram;
+ memset(&diagram, 0, sizeof(jcv_diagram));
+ jcv_rect rect {{0.0, 0.0}, {width, height}};
+ jcv_point *pts = reinterpret_cast(grid_centers->data()); /* hackety hack */
+ jcv_diagram_generate(grid_centers->size(), pts, &rect, 0, &diagram);
+ /* Relax points, i.e. wiggle them around a little bit to equalize differences between cell sizes a little bit. */
+ voronoi_relax_points(&diagram, pts);
+ memset(&diagram, 0, sizeof(jcv_diagram));
+ jcv_diagram_generate(grid_centers->size(), pts, &rect, 0, &diagram);
+
+ /* For each voronoi cell calculated above, find the brightness of the blurred image pixel below its center. We do
+ * not have to average over the entire cell's area here: The blur is doing a good approximation of that while being
+ * simpler and faster.
+ *
+ * We do this step before generating the cell poygons below because we have to look up a cell's neighbor's fill
+ * factor during gap filling for minimum feature size preservation. */
+ vector fill_factors(diagram.numsites); /* Factor to be multiplied with site polygon radius to yield target
+ fill level */
+ const jcv_site* sites = jcv_diagram_get_sites(&diagram);
+ int j = 0;
+ for (int i=0; i(
+ (int)round(center.y / height * blurred.rows),
+ (int)round(center.x / width * blurred.cols)) / 255.0;
+ fill_factors[sites[i].index] = sqrt(pxd);
+ }
+
+ /* Minimum gap between adjacent scaled site polygons. */
+ double min_gap_px = min_feature_size_px;
+ vector adjusted_fill_factors;
+ adjusted_fill_factors.reserve(32); /* Vector to hold adjusted fill factors for each edge for gap filling */
+ /* now iterate over all voronoi cells again to generate each cell's scaled polygon halftone blob. */
+ for (int i=0; ineighbor != nullptr) { /* nullptr -> edge is on the voronoi map's border */
+ double rad = sqrt(pow(center.x - e->neighbor->p.x, 2) + pow(center.y - e->neighbor->p.y, 2)) / 2.0;
+ double fill_factor_theirs = fill_factors[e->neighbor->index];
+ double gap_px = (1.0 - fill_factor_ours) * rad + (1.0 - fill_factor_theirs) * rad;
+
+ if (gap_px > min_gap_px) {
+ /* all good. gap is wider than minimum. */
+ } else if (gap_px > 0.5 * min_gap_px) {
+ /* gap is narrower than minimum, but more than half of minimum width. */
+ /* force gap open, distribute adjustment evenly on left/right */
+ double fill_factor_adjustment = (min_gap_px - gap_px) / 2.0 / rad;
+ adjusted_fill_factor -= fill_factor_adjustment;
+ } else {
+ /* gap is less than half of minimum width. Force gap closed. */
+ adjusted_fill_factor = 1.0;
+ }
+ }
+ adjusted_fill_factors.push_back(adjusted_fill_factor);
+ e = e->next;
+ }
+
+ /* Now, generate the actual halftone blob polygon */
+ ClipperLib::Path cell_path;
+ double last_fill_factor = adjusted_fill_factors.back();
+ e = sites[i].edges;
+ j = 0;
+ while (e) {
+ double fill_factor = adjusted_fill_factors[j];
+ if (last_fill_factor != fill_factor) {
+ /* Fill factor was adjusted since last edge, so generate one extra point so we have a nice radial
+ * "step". */
+ double x = e->pos[0].x;
+ double y = e->pos[0].y;
+ x = center.x + (x - center.x) * fill_factor;
+ y = center.y + (y - center.y) * fill_factor;
+
+ cairo_user_to_device(cr, &x, &y);
+ cell_path.push_back({ (ClipperLib::cInt)round(x * clipper_scale), (ClipperLib::cInt)round(y * clipper_scale) });
+ }
+
+ /* Emit endpoint of current edge */
+ double x = e->pos[1].x;
+ double y = e->pos[1].y;
+ x = center.x + (x - center.x) * fill_factor;
+ y = center.y + (y - center.y) * fill_factor;
+
+ cairo_user_to_device(cr, &x, &y);
+ cell_path.push_back({ (ClipperLib::cInt)round(x * clipper_scale), (ClipperLib::cInt)round(y * clipper_scale) });
+
+ j += 1;
+ last_fill_factor = fill_factor;
+ e = e->next;
+ }
+
+ /* Now, clip the halftone blob generated above against the given clip path. We do this individually for each
+ * blob since this way is *much* faster than throwing a million blobs at once at poor clipper. */
+ ClipperLib::Paths polys;
+ ClipperLib::Clipper c;
+ c.AddPath(cell_path, ClipperLib::ptSubject, /* closed */ true);
+ if (!clip_path.empty()) {
+ c.AddPaths(clip_path, ClipperLib::ptClip, /* closed */ true);
+ }
+ c.StrictlySimple(true);
+ c.Execute(ClipperLib::ctIntersection, polys, ClipperLib::pftNonZero, ClipperLib::pftNonZero);
+
+ /* Export halftone blob to debug svg */
+ cairo_save(cr);
+ cairo_set_matrix(cr, &viewport_matrix);
+ cairo_new_path(cr);
+ ClipperLib::cairo::clipper_to_cairo(polys, cr, CAIRO_PRECISION, ClipperLib::cairo::tNone);
+ cairo_set_source_rgba(cr, 1, 1, 1, 1);
+ cairo_fill(cr);
+ cairo_restore(cr);
+
+ /* And finally, export halftone blob to gerber. */
+ cairo_save(cr);
+ cairo_identity_matrix(cr);
+ for (const auto &poly : polys) {
+ /* FIXME */
+ //export_as_gerber(cr, poly, /* dark */ true);
+ }
+ cairo_restore(cr);
+ }
+
+ blurred.release();
+ jcv_diagram_free( &diagram );
+ delete grid_centers;
+ cairo_restore(cr);
+}
+
+
diff --git a/src/vec_core.h b/src/vec_core.h
new file mode 100644
index 0000000..20ffd24
--- /dev/null
+++ b/src/vec_core.h
@@ -0,0 +1,37 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef VEC_CORE_H
+#define VEC_CORE_H
+
+#include
+#include
+#include
+#include "vec_grid.h"
+
+namespace vectorizer {
+ void vectorize_image(cairo_t *cr, const pugi::xml_node &node, double min_feature_size_px, ClipperLib::Paths &clip_path, cairo_matrix_t &viewport_matrix);
+}
+
+#endif /* VEC_CORE_H */
diff --git a/src/vec_grid.cpp b/src/vec_grid.cpp
new file mode 100644
index 0000000..0a3eaa2
--- /dev/null
+++ b/src/vec_grid.cpp
@@ -0,0 +1,105 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "poisson_disk_sampling.h"
+
+#include "vec_grid.h"
+
+using namespace std;
+using namespace vectorizer;
+
+sampling_fun vectorizer::get_sampler(enum grid_type type) {
+ switch(type) {
+ case POISSON_DISC:
+ return sample_poisson_disc;
+ case HEXGRID:
+ return sample_hexgrid;
+ case SQUAREGRID:
+ return sample_squaregrid;
+ default:
+ return sample_poisson_disc;
+ }
+}
+
+vector *vectorizer::sample_poisson_disc(double w, double h, double center_distance) {
+ d2p top_left {0, 0};
+ d2p bottom_right {w, h};
+ return new auto(thinks::PoissonDiskSampling(center_distance, top_left, bottom_right));
+}
+
+vector *vectorizer::sample_hexgrid(double w, double h, double center_distance) {
+ double radius = center_distance / 2.0 / (sqrt(3) / 2.0); /* radius of hexagon */
+ double pitch_v = 1.5 * radius;
+ double pitch_h = center_distance;
+
+ /* offset of first hexagon to make sure the entire area is covered. We use slightly larger values here to avoid
+ * corner cases during clipping in the voronoi map generator. The inaccuracies this causes at the edges are
+ * negligible. */
+ double off_x = 0.5001 * center_distance;
+ double off_y = 0.5001 * radius;
+
+ /* NOTE: The voronoi generator is not quite stable when points lie outside the bounds. Thus, floor(). */
+ long long int points_x = floor(w / pitch_h);
+ long long int points_y = floor(h / pitch_v);
+
+ vector *out = new vector();
+ out->reserve((points_x+1) * points_y);
+
+ /* This may generate up to one extra row of points. We don't care since these points will simply be clipped during
+ * voronoi map generation. */
+ for (long long int y_i=0; y_ipush_back(d2p{off_x + x_i * pitch_h, off_y + y_i * pitch_v});
+ }
+
+ for (long long int x_i=0; x_ipush_back(d2p{off_x + (x_i - 0.5) * pitch_h, off_y + (y_i + 1) * pitch_v});
+ }
+ }
+
+ return out;
+}
+
+vector *vectorizer::sample_squaregrid(double w, double h, double center_distance) {
+ /* offset of first square to make sure the entire area is covered. We use slightly larger values here to avoid
+ * corner cases during clipping in the voronoi map generator. The inaccuracies this causes at the edges are
+ * negligible. */
+ double off_x = 0.5 * center_distance;
+ double off_y = 0.5 * center_distance;
+
+ long long int points_x = ceil(w / center_distance);
+ long long int points_y = ceil(h / center_distance);
+
+ vector *out = new vector();
+ out->reserve(points_x * points_y);
+
+ for (long long int y_i=0; y_ipush_back({off_x + x_i*center_distance, off_y + y_i*center_distance});
+ }
+ }
+
+ return out;
+}
+
diff --git a/src/vec_grid.h b/src/vec_grid.h
new file mode 100644
index 0000000..cdd61df
--- /dev/null
+++ b/src/vec_grid.h
@@ -0,0 +1,52 @@
+/*
+ * This program source code file is part of KICAD, a free EDA CAD application.
+ *
+ * Copyright (C) 2021 Jan Sebastian Götte
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef VEC_GRID_H
+#define VEC_GRID_H
+
+#include
+#include
+#include
+
+namespace vectorizer {
+
+typedef std::array d2p;
+
+enum grid_type {
+ POISSON_DISC,
+ HEXGRID,
+ SQUAREGRID
+};
+
+typedef std::function *(double, double, double)> sampling_fun;
+
+sampling_fun get_sampler(enum grid_type type);
+
+std::vector *sample_poisson_disc(double w, double h, double center_distance);
+std::vector *sample_hexgrid(double w, double h, double center_distance);
+std::vector *sample_squaregrid(double w, double h, double center_distance);
+
+} /* namespace vectorizer */
+
+#endif /* VEC_GRID_H */
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Overview/Changes.htm b/upstream/clipper-6.4.2/Documentation/Docs/Overview/Changes.htm
new file mode 100644
index 0000000..c05e9b3
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Overview/Changes.htm
@@ -0,0 +1,1269 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Changes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Changes
+
+
+
+
+
+
+
+
+ v6.2.1 (31 October 2014)
+
+
+
+ Bugfix:
+
+ Bugfix in ClipperOffset.Execute where the Polytree.IsHole property was returning incorrect values with negative offsets
+
+
+
+
+
+
+
+ Modified:
+
+ Very minor improvement to join rounding in ClipperOffset
+
+
+
+
+
+
+
+ Bugfix:
+
+ Fixed CPP OpenGL demo
+
+
+
+
+
+
+
+ v6.2.0 (26 September 2014)
+
+
+
+ Bugfix:
+
+ Numerous minor bugfixes - too many to list. (See revisions 454-475 in Sourceforge Repository.)
+
+
+
+
+ Modified:
+
+
+
+ Modified:
+
+ Deprecated functions have been removed.
+
+
+
+
+ Modified:
+
+ The Curves demo has been temporarily removed. (It needs to be updated but that was holding up this latest release of the Clipper library.)
+
+
+
+
+
+
+
+ v6.1.3 (18 January 2014)
+
+
+
+ Bugfix:
+
+ Fixed potential endless loop condition when adding open paths to Clipper.
+
+
+
+
+ Bugfix:
+
+ Fixed missing implementation of SimplifyPolygon function in C++ code.
+
+
+
+
+ Bugfix:
+
+ Fixed incorrect upper range constant for polygon coordinates in Delphi code.
+
+
+
+
+ Added:
+
+
+
+ Added:
+
+ Overloaded MinkowskiSum function to accommodate multi-contour paths.
+
+
+
+
+ Modified:
+
+ Documentation updated.
+
+
+
+
+
+
+
+ v6.1.2 (15 December 2013)
+
+
+
+ Bugfix:
+
+Fixed broken C++ header file.
+
+
+
+
+ Modified:
+
+Minor improvement to joining polygons.
+
+
+
+
+
+
+
+ v6.1.1 (13 December 2013)
+
+
+
+ Bugfix:
+
+Fixed a couple of bugs affecting open paths that could raise unhandled exceptions.
+
+
+
+
+
+
+
+ v6.1.0 (2 December 2013)
+
+
+
+ Deleted:
+ Previously deprecated code has been removed.
+
+
+
+ Modified:
+
+The OffsetPaths function is now deprecated as it has been replaced by the ClipperOffset class which is much more flexible.
+
+
+
+
+ Bugfix:
+
+Several minor bugs have been fixed including occasionally an incorrect nesting within the PolyTree structure.
+
+
+
+
+
+
+
+ v6.0.0 (30 October 2013)
+
+
+ Ver 6 is a MAJOR update that adds support for open path clipping.
+
+
+
+
+
+ Added:
+
+Open path (polyline) clipping. A new 'Curves' demo application showcases this (see the 'Curves' directory).
+
+
+
+
+
+
+
+ Update:
+
+Major improvement in the merging of shared/collinear edges in clip solutions (see Execute ).
+
+
+
+
+
+
+
+ Added:
+
+The IntPoint
+structure now has an optional 'Z' member. (See the precompiler directive
+ use_xyz .)
+
+
+
+
+
+
+
+ Added:
+
+Users can now force Clipper to use 32bit integers (via the precompiler
+directive use_int32 )
+instead of using 64bit integers. Using 32bit integers improves clipping
+performance by about 20-30%. (This has required the introduction of a
+new cInt
+integer type.) The trade-off to this speed up in performance is a very
+restricted vertex coordinate range of ± 46340.
+
+
+
+
+
+
+
+ Modified:
+
+To accommodate open paths, the Polygon and Polygons structures have been renamed Path and Paths
+respectively. The AddPolygon and AddPolygons methods of the ClipperBase class have been renamed AddPath and AddPaths respectively. Several other functions have been similarly renamed.
+
+
+
+
+
+
+
+ Modified:
+
+The PolyNode Class has a new IsOpen property (to support open paths).
+
+
+
+
+
+
+
+
+
+
+
+ Bugfix:
+
+Numerous minor bugs have been fixed.
+
+
+
+
+
+
+
+ Deprecated:
+
+Version 6 is a major upgrade from previous versions and quite a number of changes have been made to exposed structures and functions . To minimize inconvenience to existing library users, some code has been retained and some added
+to maintain backward compatibility. However, because this code will be
+removed in a future update, it has been marked as deprecated and a
+precompiler directive use_deprecated
+has been defined.
+
+
+
+
+
+
+
+ v5.1.6 (23 May 2013)
+
+
+
+ BugFix:
+
+
+
+ Added:
+
+New OffsetPolyLines function. (Replaced with OffsetPaths function in
+ver 6.)
+
+
+
+
+ Changed:
+
+The behaviour of the 'miter' JoinType has
+been changed so that when squaring occurs, it's no longer extended up
+to the miter limit but is squared off at exactly 'delta' units. (This
+improves the look of mitering with larger limits at acute angles.)
+
+
+
+
+ Update:
+
+Minor code refactoring and optimisations.
+
+
+
+
+
+
+ v5.1.5 (5 May 2013)
+
+
+
+ Update:
+
+ForceSimple property added to the Clipper Class. (Renamed
+StrictlySimple in ver 6.)
+
+
+
+
+ Update:
+
+Further improvements to this documentation.
+
+
+
+
+ Update:
+
+Minor code optimisations and trivial bug fixes.
+
+
+
+
+
+
+ v5.1.4 (24 March 2013)
+
+
+
+ Update:
+
+
+
+ Update:
+
+Documentation improved.
+
+
+
+
+
+
+ v5.1.3 (12 March 2013)
+
+
+
+ Bugfix:
+
+
+
+ Update:
+
+Documentation significantly improved.
+
+
+
+
+
+
+ v5.1.2 (26 February 2013)
+
+
+
+ Bugfix:
+
+PolyNode class was missing a constructor.
+
+
+
+
+ Update:
+
+The MiterLimit parameter in the OffsetPolygons
+function has been renamed Limit and can now also be used to
+limit the number of vertices used to construct arcs when JoinType is
+set to jtRound.
+
+
+
+
+
+
+ v5.1.0 (17 February 2013)
+
+
+
+ Update:
+
+ExPolygons has been replaced with the PolyTree / PolyNode
+classes to more fully represent the parent-child relationships of the
+polygons returned by Clipper's Execute
+method.
+
+
+
+
+ Added:
+
+
+
+ Bugfix:
+
+Another orientation bug fixed.
+
+
+
+
+
+
+ v5.0.2 (30 December 2012)
+
+
+
+ Bugfix:
+
+Significant fixes in and tidy of the internal Int128 class (which is
+used only when polygon coordinate values are greater than ±0x3FFFFFFF
+(~1.07e9)).
+
+
+
+
+ Update:
+
+The Area function
+has been updated with a faster algorithm.
+
+
+
+
+ Update:
+
+Documentation updates. The newish but undocumented 'CheckInputs'
+parameter of the OffsetPolygons
+function has been renamed 'AutoFix' and documented too. The comments on
+ rounding have also been improved
+(ie clearer and expanded).
+
+
+
+
+
+
+ v4.10.0 (25 December 2012)
+
+
+
+ Bugfix:
+
+Orientation bugs should now be resolved (finally!).
+
+
+
+
+ Bugfix:
+
+Bug in Int128 class.
+
+
+
+
+
+
+ v4.9.8 (2 December 2012)
+
+
+
+ Bugfix:
+
+Further fixes to rare Orientation bug.
+
+
+
+
+
+
+ v4.9.7 (29 November 2012)
+
+
+
+ Bugfix:
+
+Bug that very rarely returned a wrong polygon orientation.
+
+
+
+
+ Bugfix:
+
+Obscure bug affecting OffsetPolygons when using jtRound for the
+JoinType parameter and when polygons also contain very large coordinate
+values.
+
+
+
+
+
+
+ v4.9.6 (9 November 2012)
+
+
+
+ Bugfix:
+
+Another obscure bug related to joining intersections.
+
+
+
+
+
+
+ v4.9.4 (2 November 2012)
+
+
+
+ Bugfix:
+
+Bugs in Int128 class occasionally causing wrong orientations.
+
+
+
+
+ Bugfix:
+
+Further fixes related to joining intersections.
+
+
+
+
+
+
+ v4.9.0 (9 October 2012)
+
+
+
+ Bugfix:
+
+Obscure bug related to joining intersections.
+
+
+
+
+
+
+ v4.8.9 (25 September 2012)
+
+
+
+ Bugfix:
+
+Obscure bug related to precision of intersections.
+
+
+
+
+
+
+ v4.8.8 (30 August 2012)
+
+
+
+ Bugfix:
+
+Fixed bug in OffsetPolygons function introduced in version 4.8.5.
+
+
+
+
+
+
+ v4.8.7 (24 August 2012)
+
+
+
+ Bugfix:
+
+ReversePolygon function in C++ translation was broken.
+
+
+
+
+ Bugfix:
+
+Two obscure bugs affecting orientation fixed too.
+
+
+
+
+
+
+ v4.8.6 (11 August 2012)
+
+
+
+ Bugfix:
+
+Potential for memory overflow errors when using ExPolygons structure.
+
+
+
+
+
+
+
+ Bugfix:
+
+The polygon coordinate range has been reduced to ± 0x3FFFFFFFFFFFFFFF
+(4.6e18).
+
+
+
+
+
+
+
+ Update:
+
+ReversePolygons function was misnamed ReversePoints in C++.
+
+
+
+
+
+
+
+ Update:
+
+SimplifyPolygon function now takes a PolyFillType parameter.
+
+
+
+
+
+
+ v4.8.5 (15 July 2012)
+
+
+
+ v4.8.4 (1 June 2012)
+
+
+
+ Bugfix:
+
+Another obscure bug affecting ExPolygons structure.
+
+
+
+
+
+
+ v4.8.3 (27 May 2012)
+
+
+
+ Bugfix:
+
+Obscure bug causing incorrect removal of a vertex.
+
+
+
+
+
+
+ v4.8.2 (21 May 2012)
+
+
+
+ Bugfix:
+
+Obscure bug could cause an exception when using ExPolygon structure.
+
+
+
+
+
+
+ v4.8.1 (12 May 2012)
+
+
+
+ Update:
+
+Code tidy and minor bug fixes.
+
+
+
+
+
+
+ v4.8.0 (30 April 2012)
+
+
+
+ Bugfix:
+
+Occasional errors in orientation fixed.
+
+
+
+
+ Update:
+
+Added notes on rounding to the
+documentation.
+
+
+
+
+
+
+ v4.7.6 (11 April 2012)
+
+
+
+ Bugfix:
+
+Fixed a bug in the Orientation
+function (affecting C# translations only).
+
+
+
+
+ Update:
+
+Minor documentation update.
+
+
+
+
+
+
+ v4.7.5 (28 March 2012)
+
+
+
+ Bugfix:
+
+Fixed a recently introduced bug that occasionally caused an unhandled
+exception in C++ and C# translations.
+
+
+
+
+
+
+ v4.7.1 (3 March 2012)
+
+
+
+ Bugfix:
+
+Rare crash when JoinCommonEdges joined polygons that 'cancelled' each
+other.
+
+
+
+
+ Bugfix:
+
+Clipper's internal Orientation method occasionally returned wrong
+result.
+
+
+
+
+ Update:
+
+Improved C# code (thanks to numerous suggestions from David Piepgrass)
+
+
+
+
+
+
+ v4.7 (10 February 2012)
+
+
+
+ Update:
+
+Improved the joining of output polygons sharing a common edge.
+
+
+
+
+
+
+ v4.6.4 (8 December 2011)
+
+
+
+ v4.6 (29 October 2011)
+
+
+
+ Added:
+
+Support for Positive and Negative polygon fill types (in addition to the EvenOdd and NonZero fill types).
+
+
+
+
+ Bugfix:
+
+The OffsetPolygons
+function was generating the occasional artefact when 'shrinking'
+polygons.
+
+
+
+
+
+
+ v4.5.5 (6 October 2011)
+
+
+
+ Bugfix:
+
+Fixed an obscure bug in Clipper's JoinCommonEdges method.
+
+
+
+
+ Update:
+
+Replaced IsClockwise function with Orientation
+function. The orientation issues affecting OffsetPolygons should
+finally be resolved.
+
+
+
+
+ Change:
+
+The Area function
+once again returns the signed area.
+
+
+
+
+
+
+ v4.4.0 (6 August 2011)
+
+
+
+ BugFix:
+
+A number of minor bugfixes that mostly affected the new ExPolygons
+structure.
+
+
+
+
+
+
+ v4.3.0 (17 June 2011)
+
+
+
+ Added:
+
+ExPolygons structure that explicitly associates 'hole' polygons with
+their 'outer' container polygons.
+
+
+
+
+ Added:
+
+ Execute
+method now overloaded so the solution parameter can be either Polygons or
+ExPolygons.
+
+
+
+
+ Bug fix:
+
+Fixed a rare bug in the orientation of solution polygons.
+
+
+
+
+
+
+ v4.2.4 (26 April 2011)
+
+
+
+ Update:
+
+Input polygon coordinates can now contain the full range of signed
+64bit integers (ie +/-9,223,372,036,854,775,807). This means that
+floating point values can be converted to and from Clipper's 64bit
+vertex structure (IntPoint )
+and still retain a precision of up to 18 decimal places. However, since
+the large-integer math that supports this expanded range imposes a
+small cost on performance (~15%), a new property UseFullCoordinateRange
+has been added to the Clipper class to allow users the choice of
+whether or not to use this expanded coordinate range. If this property
+is disabled, coordinate values are restricted to +/-1,500,000,000. (By
+default, this property is enabled.)
+
+
+
+
+
+
+ v4.0 (4 April 2011)
+
+
+
+ Major update:
+
+Clipper is a major rewrite of earlier versions. The biggest change is
+that floating point values are no longer used, except for the storing
+of edge slope values. The main benefit of this is the issue of
+numerical robustness has been addressed. Due to other major code
+improvements Clipper v4 is approximately 40% faster than Clipper v3.
+
+
+
+
+ Changes:
+
+The AddPolyPolygon method has been renamed to AddPolygons, and the
+IgnoreOrientation property has been removed. The clipper_misc library
+has been merged back into the clipper library.
+
+
+
+
+
+
+ v2.8 (20 November 2010)
+
+
+
+ Updated:
+
+Output polygons which previously shared a common edge are now merged.
+
+
+
+
+ Added:
+
+Added support module for Cairo Graphics Library (with accompanying
+demo).
+
+
+
+
+ Added:
+
+Added C# and C++ demos.
+
+
+
+
+
+
+ v2.522 (15 October 2010)
+
+
+
+ Added:
+
+Added C# translation (thanks to Olivier Lejeune) and a link to Ruby
+bindings (thanks to Mike Owens).
+
+
+
+
+
+
+ v2.0 (31 July 2010)
+
+
+
+ Major update:
+
+Clipper now processes polygons using both the Even-Odd (alternate) and
+Non-Zero (winding) filling rules.
+
+
+
+
+
+
+ v1.4c (16 June 2010)
+
+
+
+ Additions:
+
+Added Delphi and C++ units to support the AGG graphics library
+
+
+
+
+
+
+ v1.2s (2 June 2010)
+
+
+
+ Additions:
+
+C++ translation of Delphi code
+
+
+
+
+
+
+ v1.0 (9 May 2010) - Initial public release
+
+
+
+
+
+
+
+ See Also
+ Deprecated , Rounding , Clipper.Constructor , Clipper.Execute , Clipper.ZFillFunction , ClipperBase.AddPath , ClipperBase.AddPaths , ClipperOffset , ClipperOffset.Execute , PolyNode , PolyTree , Area , CleanPolygon , CleanPolygons , ClosedPathsFromPolyTree , MinkowskiDiff , MinkowskiSum , OffsetPaths , OpenPathsFromPolyTree , Orientation , PointInPolygon , PolyTreeToPaths , SimplifyPolygon , SimplifyPolygons , Defines , CInt , InitOptions , IntPoint , Path , Paths , PolyFillType , ZFillCallback
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Overview/Deprecated.htm b/upstream/clipper-6.4.2/Documentation/Docs/Overview/Deprecated.htm
new file mode 100644
index 0000000..7a8f254
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Overview/Deprecated.htm
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Deprecated
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Deprecated
+
+
+ The precompiler directive 'use_deprecated' allows users to update the Clipper library without being forced to make immediate changes to code that accesses the library. Depricated code will be removed in a future update. (Enabled by default.) Deprecated types and functions: All deprecated code has been removed from version 6.2.0.
+
+
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Overview/Example.htm b/upstream/clipper-6.4.2/Documentation/Docs/Overview/Example.htm
new file mode 100644
index 0000000..ded5dd5
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Overview/Example.htm
@@ -0,0 +1,234 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Example
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Example
+
+
+
+ Delphi Code Sample:
+
+
+
+
+
+
+ uses
+ graphics32, clipper;
+
+ function GetEllipsePoints(bounds: TIntRect): TPath;
+ begin
+ //code to create an elliptical polygon here
+ end;
+
+ procedure DrawPolygons(polys: TPaths; color: TColor32);
+ begin
+ //code to display the polygons here
+ end;
+
+ var
+ sub, clp, sol: TPaths;
+ begin
+
+ //set up the subject and clip polygons ...
+ setlength(sub, 3);
+ sub[0] := GetEllipsePoints(IntRect(100,100,300,300));
+ sub[1] := GetEllipsePoints(IntRect(125,130,275,180));
+ sub[2] := GetEllipsePoints(IntRect(125,220,275,270));
+
+ setlength(clp, 1);
+ clp[0] := GetEllipsePoints(IntRect(140,70,220,320));
+
+ //display the subject and clip polygons ...
+ DrawPolygons(sub, 0x8033FFFF);
+ DrawPolygons(clp, 0x80FFFF33);
+
+ //get the intersection of the subject and clip polygons ...
+ with TClipper.Create do
+ try
+ AddPaths(sub, ptSubject, true);
+ AddPaths(clp, ptClip, true);
+ Execute(ctIntersection, sol, pftEvenOdd, pftEvenOdd);
+ finally
+ free;
+ end;
+
+ //finally draw the intersection polygons ...
+ DrawPolygons(sol, 0x40808080);
+
+
+
+
+
+
+
+
+
+
+
+ C++ Code Sample:
+
+
+
+
+
+
+ #include "clipper.hpp"
+
+ ...
+
+ //from clipper.hpp ...
+ //typedef long long cInt;
+ //struct IntPoint {cInt X; cInt Y;};
+ //typedef std::vector<IntPoint> Path;
+ //typedef std::vector<Polygon> Paths;
+
+ using namespace ClipperLib;
+
+ void GetEllipsePoints(IntRect& bounds, Path& p)
+ {/* ... */}
+
+ void DrawPolygons(Paths& p, unsigned color)
+ {/* ... */}
+
+ int main()
+ {
+ //set up the subject and clip polygons ...
+ Paths sub(3);
+ GetEllipsePoints(IntRect(100,100,300,300), sub[0]);
+ GetEllipsePoints(IntRect(125,130,275,180), sub[1]);
+ GetEllipsePoints(IntRect(125,220,275,270), sub[2]);
+
+ Paths clp(1);
+ GetEllipsePoints(IntRect(140,70,220,320), clp[0]);
+
+ //display the subject and clip polygons ...
+ DrawPolygons(sub, 0x8033FFFF);
+ DrawPolygons(clp, 0x80FFFF33);
+
+ //get the intersection of the subject and clip polygons ...
+ Clipper clpr;
+ clpr.AddPaths(sub, ptSubject, true);
+ clpr.AddPaths(clp, ptClip, true);
+ Paths solution;
+ clpr.Execute(ctIntersection, solution, pftEvenOdd, pftEvenOdd);
+
+ //finally draw the intersection polygons ...
+ DrawPolygons(solution, 0x40808080);
+ }
+
+
+
+
+
+
+
+
+
+
+
+ C# Code Sample:
+
+
+
+
+
+
+ ...
+ using ClipperLib;
+
+ ...
+ using Path = List<IntPoint>;
+ using Paths = List<List<IntPoint>>;
+
+ static Path GetEllipsePoints(IntRect bounds)
+ {/* ... */}
+
+ static void DrawPolygons(Path p, uint color)
+ {/* ... */}
+
+ static void Main(string[] args)
+ {
+ Paths subjs = new Paths(3);
+ subjs.Add(GetEllipsePoints(new IntRect(100,100,300,300)));
+ subjs.Add(GetEllipsePoints(new IntRect(125,130,275,180)));
+ subjs.Add(GetEllipsePoints(new IntRect(125,220,275,270)));
+
+ Paths clips = new Paths(1);
+ clips.Add(GetEllipsePoints(new IntRect(140,70,220,320)));
+
+ DrawPolygons(subjs, 0x8033FFFF);
+ DrawPolygons(clips, 0x80FFFF33);
+
+ Paths solution = new Paths();
+ Clipper c = new Clipper();
+ c.AddPaths(subjs, PolyType.ptSubject, true);
+ c.AddPaths(clips, PolyType.ptClip, true);
+ c.Execute(ClipType.ctIntersection, solution);
+
+ DrawPolygons(solution, 0x40808080);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Overview/FAQ.htm b/upstream/clipper-6.4.2/Documentation/Docs/Overview/FAQ.htm
new file mode 100644
index 0000000..91459b9
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Overview/FAQ.htm
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FAQ
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FAQ
+
+
+ Why does Clipper use integer coordinates, not floats?
+
+ This has been done to preserve numerical robustness . Early versions of the library did use floating point coordinates, but it became apparent that floating point imprecision was always going to cause occasional errors.
+
+
+ How do I use floating point coordinates with Clipper?
+
+ It's a simple task to multiply your floating point coordinates by a scaling factor (that's typically a power of 10 depending on the desired precision). Then with the solution paths, divide the returned coordinates by this same scaling factor. Clipper accepts integer coordinates as large as ±4.6e18, so it can accommodate very large scaling.
+
+
+ Does Clipper handle polygons with holes?
+
+ 'Holes' are defined by the specified polygon filling rule . (See also Clipper.Execute )
+
+
+ Some polygons in the solution share a common edge. Is this a bug?
+
+ No, though this should happen rarely as of version 6. (See Clipper.Execute for more about this.)
+
+
+ I have lots of polygons that I want to 'union'. Can I do this in one operation?
+
+ Yes. Just add all the polygons as subject polygons to the Clipper object. (You don't have to assign both subject and clip polygons.)
+
+
+ The polygons produced by ClipperOffset have tiny artefacts? Could this be a bug?
+
+ Make sure the input polygons don't self-intersect. Tiny self-intersections can sometimes be produced by previous clipping operations. These can be cleaned up using the CleanPolygon and CleanPolygons functions. Also, make sure the supplied polygons don't overlap. If they do, offset these separately. Finally, the precision of the input coordinates may be a problem. Because the Clipper Library only operates on integer coordinates, you may need to scale your coordinates (eg by a factor of 10) to improve precision.
+
+
+ Is there an easy way to reverse polygon orientations?
+
+ Yes, see ReversePaths .
+
+
+
+
+ My drawings contain lots of beziers, ellipses and arcs. How can I perform clipping operations on these?
+
+ You'll have to convert them to 'flattened' paths. For an example of how this can be done (and even reconstructed back into beziers, arcs etc), see the CurvesDemo application included in this library.
+
+
+ See Also
+ Clipper.Execute , ClipperOffset , CleanPolygon , CleanPolygons , ReversePaths , PolyFillType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Overview/License.htm b/upstream/clipper-6.4.2/Documentation/Docs/Overview/License.htm
new file mode 100644
index 0000000..928dda8
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Overview/License.htm
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ License
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ License
+
+
+ The Clipper Library (including Delphi, C++ & C# source code, other accompanying code, examples and documentation), hereafter called "the Software", has been released under the following license, terms and conditions:
+
+
+ Boost Software License - Version 1.0 - August 17th, 2003 http://www.boost.org/LICENSE_1_0.txt
+
+
+ Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the Software covered by this license to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following:
+
+
+ The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.
+
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 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 DEALINGS IN THE SOFTWARE.
+
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Overview/Rounding.htm b/upstream/clipper-6.4.2/Documentation/Docs/Overview/Rounding.htm
new file mode 100644
index 0000000..cb4d62b
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Overview/Rounding.htm
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Rounding
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Rounding
+
+
+ By using an integer type for polygon coordinates, the Clipper Library has been able to avoid problems of numerical robustness that can cause havoc with geometric computations. Problems associated with integer rounding and their possible solutions are discussed below. It's important to stress at the outset that rounding causes vertices to move fractions of a unit away from their 'true' positions. Nevertheless, the resulting imprecision can be very effectively managed by appropriate scaling. The Clipper Library supports scaling to very high degrees of precision by accepting integer coordinate values in the range ±0x3FFFFFFFFFFFFFFF (± 4.6e+18). Another complication of using a discrete numbers (as opposed to real numbers ) is that very occasionally tiny self-intersection artefacts arise. In the unscaled image on the left (where one unit equals one pixel), the area of intersection of two polygons has been highlighted in bright green.
+
+
+ A 30X 'close up' of the lower points of intersection of these same two polygons shows the presence of a tiny self-intersecting artefact. The three 'black dots' highlight the actual points of intersection (with their fractional coordinates displayed). The 'red dots' show where these points of intersection are located once rounding is applied. With a little care you can see that rounding reverses the orientation of these vertices and causes a tiny self-intersecting artefact. Although these tiny self-intersections are uncommon, if it's deemed necessary, they are best removed with CleanPolygons . (Setting Clipper's StrictlySimple property to true would also address this self-intersection but the tiny (sub-unit) polygon 'artefact' with incorrect orientation would still appear in the solution.)
+
+
+ In this final example, the single polygon on the left also has a tiny self-intersection. However, the clipping algorithm sees this vertex (88,50) as simply 'touching' rather than intersecting the right edge of the polygon (though only by a fraction of a unit). Since this intersection won't normally be detected, the clipping solution (eg following a union operation) will still contain this tiny self-intersection. Setting Clipper's StrictlySimple property to true avoids this uncommon problem.
+
+
+
+ See Also
+ Clipper.StrictlySimple , CleanPolygons
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Overview/_Body.htm b/upstream/clipper-6.4.2/Documentation/Docs/Overview/_Body.htm
new file mode 100644
index 0000000..5135549
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Overview/_Body.htm
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+
+
+ The Clipper Library performs clipping , and offsetting of both lines and polygons. A number of features set Clipper apart from other clipping libraries:
+
+
+ it accepts all types of polygons including self-intersecting ones
+
+ it supports multiple polygon filling rules (EvenOdd, NonZero, Positive, Negative)
+
+ it's very fast relative to other libraries
+
+ it's numerically robust
+
+ it also performs line and polygon offsetting
+
+ it's free to use in both freeware and commercial applications
+
+
+
+
+ Current Version: 6.2.1 Author & copyright: Angus Johnson. Copyright © 2010-2014 License, terms and conditions: Boost Software License
+
+
+ Terminology:
+
+
+ Clipping: commonly refers to the process of cutting away from a set of 2-dimensional geometric shapes those parts that are outside a rectangular 'clipping ' window. This can be achieved by intersecting subject paths (lines and polygons) with a clipping rectangle. In a more general sense, the clipping window need not be rectangular but can be any type of polygon, even multiple polygons. Also, while clipping typically refers to an intersection operation, in this documentation it will refer to any one of the four boolean operations (intersection, union, difference and exclusive-or).
+
+ Path: is an ordered sequence of vertices defining a single geometric contour that's either a line (an open path) or a polygon (a closed path).
+
+ Line: or polyline is an open path containing 2 or more vertices.
+
+ Polygon: commonly refers to a two-dimensional region bounded by an outer non-intersecting closed contour. That region may also contain a number of 'holes'. In this documentation however, polygon will simply refer to a closed path.
+
+ Contour: synonymous with path.
+
+ Hole: is a closed region within a polygon that's not part of the polygon. A 'hole polygon' is a closed path that forms the outer boundaries of a hole.
+
+ Polygon Filling Rule: the filling rule , together with a list of closed paths, defines those regions (bounded by paths) that are inside (ie regions 'brush filled' in a graphical display) and those which are outside (ie 'holes').
+
+
+
+
+ Distribution package contents: The ZIP package contains the Clipper library's source code, a Windows CHM help file, HTML help, and a number of compiled demo applications (with full source code). The library was initially written in Delphi Pascal (and compiles with Delphi version 7 or above) but now contains C++ , C# and Python translations too. The library's source code in each language is about 5000 lines. The Delphi code contains reasonably extensive comments, but comments are fewer in the C++ and C# code. The included sample applications show how Clipper can be used with the different languages using a number of graphics display libraries including - AGG, Cairo, OpenGL, Graphics32, GDI+ and SVG . Download Link: SourceForge References: The Library is based on but significantly extends Bala Vatti's polygon clipping algorithm as described in "A generic solution to polygon clipping" , Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. A section in "Computer graphics and geometric modeling: implementation and algorithms" by By Max K. Agoston (Springer, 2005) discussing Vatti Polygon Clipping was also helpful in creating the initial Clipper implementation. The paper titled "Polygon Offsetting by Computing Winding Numbers" by Chen & McMains (Paper no. DETC2005-85513, ASME 2005. Pages 565-575) contains helpful discussion on the complexities of polygon offsetting together with some solutions.
+
+
+ See Also
+ Source , License , Clipper , ClipperOffset , ClipType , PolyFillType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Constructor.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Constructor.htm
new file mode 100644
index 0000000..f51279f
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Constructor.htm
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Constructor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clipper.Constructor
+
+
+ constructor TClipper.Create(InitOptions: TInitOptions = []);
+
+ Clipper::Clipper(int initOptions = 0) : ClipperBase();
+
+ public Clipper(initOptions = 0): base() {};
+
+ The Clipper constructor creates an instance of the Clipper class. One or more InitOptions may be passed as a parameter to set the corresponding properties. (These properties can still be set or reset after construction.) Examples:
+
+
+
+
+
+
+ //C++ constructor setting StrictlySimple and PreserveCollinear properties ...
+ Clipper clipper(ioStrictlySimple | ioPreserveCollinear);
+
+ //C# constructor setting StrictlySimple and PreserveCollinear properties ...
+ Clipper clipper = new Clipper(Clipper.ioStrictlySimple | Clipper.ioPreserveCollinear);
+
+ //Delphi constructor setting StrictlySimple and PreserveCollinear properties ...
+ clipper := TClipper.Create([ioStrictlySimple, ioPreserveCollinear]);
+
+
+
+
+
+
+
+
+
+
+
+ See Also
+ PreserveCollinear , ReverseSolution , StrictlySimple , InitOptions
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Execute.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Execute.htm
new file mode 100644
index 0000000..b551a19
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Execute.htm
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Execute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clipper.Execute
+
+
+ function Execute(clipType: TClipType ; out solution: TPaths ; subjFillType: TPolyFillType = pftEvenOdd; clipFillType: TPolyFillType = pftEvenOdd): boolean; overload ; function Execute(clipType: TClipType ; out solution: TPolyTree ; subjFillType: TPolyFillType = pftEvenOdd; clipFillType: TPolyFillType = pftEvenOdd): boolean; overload ;
+
+
+ bool Execute(ClipType clipType, Paths &solution, PolyFillType subjFillType = pftEvenOdd, PolyFillType clipFillType = pftEvenOdd); bool Execute(ClipType clipType, PolyTree &solution, PolyFillType subjFillType = pftEvenOdd, PolyFillType clipFillType = pftEvenOdd);
+
+ public bool Execute(ClipType clipType, Paths solution, PolyFillType subjFillType, PolyFillType clipFillType); public bool Execute(ClipType clipType, PolyTree solution, PolyFillType subjFillType, PolyFillType clipFillType);
+
+
+
+ Once subject and clip paths have been assigned (via AddPath and/or AddPaths ), Execute can then perform the clipping operation (intersection, union, difference or XOR) specified by the clipType parameter. The solution parameter can be either a Paths or PolyTree structure. The Paths structure is simpler than the PolyTree stucture. Because of this it is quicker to populate and hence clipping performance is a little better (it's roughly 10% faster). However, the PolyTree data structure provides more information about the returned paths which may be important to users. Firstly, the PolyTree structure preserves nested parent-child polygon relationships (ie outer polygons owning/containing holes and holes owning/containing other outer polygons etc). Also, only the PolyTree structure can differentiate between open and closed paths since each PolyNode has an IsOpen property. (The Path structure has no member indicating whether it's open or closed.) For this reason, when open paths are passed to a Clipper object, the user must use a PolyTree object as the solution parameter , otherwise an exception will be raised. When a PolyTree object is used in a clipping operation on open paths, two ancilliary functions have been provided to quickly separate out open and closed paths from the solution - OpenPathsFromPolyTree and ClosedPathsFromPolyTree . PolyTreeToPaths is also available to convert path data to a Paths structure (irrespective of whether they're open or closed ). There are several things to note about the solution paths returned:
+
+
+ they aren't in any specific order
+
+ they should never overlap or be self-intersecting (but see notes on rounding )
+
+ holes will be oriented opposite outer polygons
+
+ the solution fill type can be considered either EvenOdd or NonZero since it will comply with either filling rule
+
+ polygons may rarely share a common edge (though this is now very rare as of version 6)
+
+
+
+
+ The subjFillType and clipFillType parameters define the polygon fill rule to be applied to the polygons (ie closed paths) in the subject and clip paths respectively. (It's usual though obviously not essential that both sets of polygons use the same fill rule.) Execute can be called multiple times without reassigning subject and clip polygons (ie when different clipping operations are required on the same polygon sets).
+
+
+ See Also
+ Example , Rounding , ClipperBase.AddPath , ClipperBase.AddPaths , PolyNode.IsOpen , PolyTree , ClosedPathsFromPolyTree , OpenPathsFromPolyTree , PolyTreeToPaths , ClipType , Path , Paths , PolyFillType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/PreserveCollinear.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/PreserveCollinear.htm
new file mode 100644
index 0000000..c198c67
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/PreserveCollinear.htm
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveCollinear
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clipper.PreserveCollinear
+
+
+ property PreserveCollinear: boolean; override ;
+
+ void PreserveCollinear(bool value);
+
+ public bool PreserveCollinear { get {} set {} };
+
+
+ By default, when three or more vertices are collinear in input polygons (subject or clip), the Clipper object removes the 'inner' vertices before clipping. When enabled the PreserveCollinear property prevents this default behavior to allow these inner vertices to appear in the solution.
+
+
+
+ See Also
+ Constructor
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/ReverseSolution.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/ReverseSolution.htm
new file mode 100644
index 0000000..4294395
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/ReverseSolution.htm
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ReverseSolution
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clipper.ReverseSolution
+
+
+ property ReverseSolution: boolean; override ;
+
+ void ReverseSolution(bool value);
+
+ public bool ReverseSolution { get {} set {} };
+
+
+ When this property is set to true, polygons returned in the solution parameter of the Execute() method will have orientations opposite to their normal orientations.
+
+
+
+
+
+ See Also
+ Execute , Orientation
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/StrictlySimple.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/StrictlySimple.htm
new file mode 100644
index 0000000..b6918cc
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/StrictlySimple.htm
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ StrictlySimple
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clipper.StrictlySimple
+
+
+ property StrictlySimple: boolean; override ;
+
+ void StrictlySimple(bool value);
+
+ public bool StrictlySimple { get {} set {} };
+
+
+ Terminology:
+
+
+ A simple polygon is one that does not self-intersect.
+
+ A weakly simple polygon is a simple polygon that contains 'touching' vertices, or 'touching' edges.
+
+ A strictly simple polygon is a simple polygon that does not contain 'touching' vertices, or 'touching' edges.
+
+
+
+ Vertices 'touch' if they share the same coordinates (and are not adjacent). An edge touches another if one of its end vertices touches another edge excluding its adjacent edges, or if they are co-linear and overlapping (including adjacent edges). Polygons returned by clipping operations (see Clipper.Execute() ) should always be simple polygons. When the StrictlySimply property is enabled, polygons returned will be strictly simple , otherwise they may be weakly simple . It's computationally expensive ensuring polygons are strictly simple and so this property is disabled by default. Note: There's currently no guarantee that polygons will be strictly simple since 'simplifying' is still a work in progress.
+
+
+ In the image above, the two examples show weakly simple polygons being broken into two strictly simple polygons. (The outlines with arrows are intended to aid visualizing vertex order.) See also the article on Simple Polygons on Wikipedia.
+
+
+
+ See Also
+ Execute , SimplifyPolygons
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/ZFillFunction.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/ZFillFunction.htm
new file mode 100644
index 0000000..290061e
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/Properties/ZFillFunction.htm
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ZFillFunction
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clipper.ZFillFunction
+
+
+ property ZFillFunction: TZFillCallback read FZFillCallback write FZFillCallback;
+
+ void ZFillFunction(ZFillCallback zFillFunc);
+
+ public ZFillCallback ZFillFunction { get ; set ; };
+
+
+ This property is only exposed when the pre-processor directive use_xyz has been defined. If this is the case, a 'Z' member will be included in the IntPoint structure where users can store custom data. While most vertices in a clipping solution will correspond to input (subject and clip) vertices, there will also be new vertices wherever edges intersect. This property assigns a custom callback function to the Clipper object so that custom 'Z' values can be assigned to these intersection vertices. (Note that 'Z' values in the solution at non-intersecting vertices will simply be copied from matching input vertices along with the X and Y values.) It is up to the library user to assign 'Z' values for new intersection vertices (otherwise these values will remain 0). The four vertices that define the intersecting line segments will be passed to the callback function (together with the new intersection vertex) to aid the user in determining appropriate Z values.
+
+
+
+ See Also
+ Defines , IntPoint , ZFillCallback
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/_Body.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/_Body.htm
new file mode 100644
index 0000000..330ecf1
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/Clipper/_Body.htm
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clipper
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clipper
+ Hierarchy
+
+ |
+ ClipperBase
+
+
+ The Clipper class encapsulates boolean operations on polygons (intersection, union, difference and XOR), which is also called polygon clipping . Input polygons, both subject and clip sets, are passed to a Clipper object by its AddPath and AddPaths methods, and the clipping operation is performed by calling its Execute method. Multiple boolean operations can be performed on the same input polygon sets by repeat calls to Execute.
+
+ Reference
+
+ See Also
+ Overview , ClipType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPath.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPath.htm
new file mode 100644
index 0000000..de8c944
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPath.htm
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AddPath
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperBase.AddPath
+
+
+ function AddPath(const path: TPath ; polyType: TPolyType ; Closed: Boolean): Boolean;
+
+ bool AddPath(const Path &pg, PolyType polyType, bool closed);
+
+ public virtual bool AddPath(Path pg, PolyType polyType, bool closed);
+
+
+
+ Any number of subject and clip paths can be added to a clipping task, either individually via the AddPath() method, or as groups via the AddPaths() method, or even using both methods. 'Subject' paths may be either open (lines) or closed (polygons) or even a mixture of both, but 'clipping' paths must always be closed . Clipper allows polygons to clip both lines and other polygons, but doesn't allow lines to clip either lines or polygons. With closed paths, orientation should conform with the filling rule that will be passed via Clippper's Execute method.
+
+
+
+ Path Coordinate range : Path coordinates must be between ± 0x3FFFFFFFFFFFFFFF (± 4.6e+18 ), otherwise a range error will be thrown when attempting to add the path to the Clipper object. If coordinates can be kept between ± 0x3FFFFFFF (± 1.0e+9 ), a modest increase in performance (approx. 15-20%) over the larger range can be achieved by avoiding large integer math. If the preprocessor directive use_int32 is defined (allowing a further increase in performance of 20-30%), then the maximum range is restricted to ± 32,767.
+
+
+ Return Value: The function will return false if the path is invalid for clipping. A path is invalid for clipping when:
+
+
+ it has less than 2 vertices
+
+ it has 2 vertices but is not an open path
+
+ the vertices are all co-linear and it is not an open path
+
+
+
+
+
+
+
+
+ See Also
+ Example , Clipper.Execute , AddPaths , Orientation , Defines , Path , PolyFillType , PolyType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPaths.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPaths.htm
new file mode 100644
index 0000000..73e1186
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/AddPaths.htm
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AddPaths
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperBase.AddPaths
+
+
+ function AddPaths(const paths: TPaths ; polyType: TPolyType ; Closed: Boolean): boolean;
+
+ bool AddPaths(const Paths &ppg, PolyType polyType, bool closed);
+
+ public virtual bool AddPaths(Paths ppg, PolyType polyType, bool closed);
+
+
+ Any number of subject and clip paths can be added to a clipping task, either individually via the AddPath() method, or as groups via the AddPaths() method, or even using both methods. 'Subject' paths may be either open (lines) or closed (polygons) or even a mixture of both, but 'clipping' paths must always be closed . Clipper allows polygons to clip both lines and other polygons, but doesn't allow lines to clip either lines or polygons. With closed paths, orientation should conform with the filling rule that will be passed via Clippper's Execute method.
+
+
+
+ Path Coordinate range : Path coordinates must be between ± 0x3FFFFFFFFFFFFFFF (± 4.6e+18 ), otherwise a range error will be thrown when attempting to add the path to the Clipper object. If coordinates can be kept between ± 0x3FFFFFFF (± 1.0e+9 ), a modest increase in performance (approx. 15-20%) over the larger range can be achieved by avoiding large integer math. If the preprocessor directive use_int32 is defined (allowing a further increase in performance of 20-30%), then the maximum range is restricted to ± 32,767.
+
+
+ Return Value: The function will return false if the path is invalid for clipping. A path is invalid for clipping when:
+
+
+ it has less than 2 vertices
+
+ it has 2 vertices but is not an open path
+
+ the vertices are all co-linear and it is not an open path
+
+
+
+
+
+
+
+
+ See Also
+ Example , Clipper.Execute , AddPaths , Orientation , Defines , Paths , PolyFillType , PolyType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/Clear.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/Clear.htm
new file mode 100644
index 0000000..e23900b
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/Clear.htm
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clear
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperBase.Clear
+
+
+ procedure Clear;
+
+ virtual void Clear();
+
+ public void Clear() {};
+
+ The Clear method removes any existing subject and clip polygons allowing the Clipper object to be reused for clipping operations on different polygon sets.
+
+
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/GetBounds.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/GetBounds.htm
new file mode 100644
index 0000000..efb949a
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/Methods/GetBounds.htm
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GetBounds
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperBase.GetBounds
+
+
+ function GetBounds: TIntRect ;
+
+ IntRect GetBounds();
+
+ public IntRect GetBounds() {...};
+
+
+ This method returns the axis-aligned bounding rectangle of all polygons that have been added to the Clipper object.
+
+
+
+
+
+ See Also
+ Example , IntRect
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/_Body.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/_Body.htm
new file mode 100644
index 0000000..64a6058
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperBase/_Body.htm
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperBase
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperBase
+
+ ClipperBase is an abstract base class for Clipper . A ClipperBase object should not be instantiated directly.
+
+
+ Reference
+
+ See Also
+ Clipper
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/AddPath.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/AddPath.htm
new file mode 100644
index 0000000..6aa26b8
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/AddPath.htm
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AddPath
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset.AddPath
+
+
+ procedure AddPath(const Path: TPath; JoinType: TJoinType; EndType: TEndType);
+
+ void AddPath(const Path& path, JoinType jointype, EndType endtype);
+
+ public void AddPath(Path path, JoinType jointype, EndType endtype);
+
+
+
+ Adds a Path to a ClipperOffset object in preparation for offsetting. Any number of paths can be added, and each has its own JoinType and EndType . All 'outer' Paths must have the same orientation, and any 'hole' paths must have reverse orientation. Closed paths must have at least 3 vertices. Open paths may have as few as one vertex. Open paths can only be offset with positive deltas.
+
+ See Also
+ EndType , JoinType , Path
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/AddPaths.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/AddPaths.htm
new file mode 100644
index 0000000..b0fe3bc
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/AddPaths.htm
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AddPaths
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset.AddPaths
+
+
+ procedure AddPaths(const Paths: TPaths; JoinType: TJoinType; EndType: TEndType);
+
+ void AddPaths(const Paths& paths, JoinType jointype, EndType endtype);
+
+ public void AddPaths(Paths paths, JoinType jointype, EndType endtype);
+
+
+
+ Adds Paths to a ClipperOffset object in preparation for offsetting. Any number of paths can be added, and each path has its own JoinType and EndType . All 'outer' Paths must have the same orientation, and any 'hole' paths must have reverse orientation. Closed paths must have at least 3 vertices. Open paths may have as few as one vertex. Open paths can only be offset with positive deltas.
+
+
+ See Also
+ EndType , JoinType , Paths
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Clear.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Clear.htm
new file mode 100644
index 0000000..7df15a6
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Clear.htm
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clear
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset.Clear
+
+
+ procedure Clear;
+
+ void Clear();
+
+ public void Clear();
+
+
+
+ This method clears all paths from the ClipperOffset object, allowing new paths to be assigned.
+
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Constructor.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Constructor.htm
new file mode 100644
index 0000000..59eed6e
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Constructor.htm
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Constructor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset.Constructor
+
+
+ constructor Create(MiterLimit: Double = 2; RoundPrecision: Double = 0.25);
+
+ ClipperOffset( double miterLimit = 2.0, double roundPrecision = 0.25);
+
+ public ClipperOffset( double miterLimit = 2.0, double roundPrecision = 0.25);
+
+
+
+ The ClipperOffset constructor takes 2 optional parameters: MiterLimit and ArcTolerance . Thes two parameters corresponds to properties of the same name. MiterLimit is only relevant when JoinType is jtMiter, and ArcTolerance is only relevant when JoinType is jtRound or when EndType is etOpenRound.
+
+
+ See Also
+ ArcTolerance , MiterLimit
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Execute.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Execute.htm
new file mode 100644
index 0000000..5ac748d
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Execute.htm
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Execute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset.Execute
+
+
+ procedure Execute(out solution: TPaths; Delta: Double); overload ;
+
+ void Execute(Paths& solution, double delta);
+
+ public void Execute(ref Paths solution, double delta);
+
+
+ procedure Execute(out PolyTree: TPolyTree; Delta: Double); overload ;
+
+ void Execute(PolyTree& polytree, double delta);
+
+ public void Execute(ref PolyTree polytree, double delta);
+
+
+
+ This method takes two parameters. The first is the structure that receives the result of the offset operation (either a PolyTree or a Paths structure). The second parameter is the amount to which the supplied paths will be offset. Negative delta values shrink polygons and positive delta expand them. This method can be called multiple times, offsetting the same paths by different amounts (ie using different deltas).
+
+
+
+
+
+
+#include "clipper.hpp"
+...
+using namespace ClipperLib;
+
+int main()
+{
+ Path subj;
+ Paths solution;
+ subj <<
+ IntPoint(348,257) << IntPoint(364,148) << IntPoint(362,148) <<
+ IntPoint(326,241) << IntPoint(295,219) << IntPoint(258,88) <<
+ IntPoint(440,129) << IntPoint(370,196) << IntPoint(372,275);
+ ClipperOffset co;
+ co.AddPath(subj, jtRound, etClosedPolygon);
+ co.Execute(solution, -7.0);
+
+ //draw solution ...
+ DrawPolygons(solution, 0x4000FF00, 0xFF009900);
+}
+
+
+
+
+
+
+
+
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/ArcTolerance.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/ArcTolerance.htm
new file mode 100644
index 0000000..9cfc79c
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/ArcTolerance.htm
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ArcTolerance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset.ArcTolerance
+
+ property ArcTolerance: double;
+
+ double ArcTolerance;
+
+ public double ArcTolerance {get; set;}
+
+
+ Firstly, this field/property is only relevant when JoinType = jtRound and/or EndType = etRound. Since flattened paths can never perfectly represent arcs, this field/property specifies a maximum acceptable imprecision ('tolerance') when arcs are approximated in an offsetting operation. Smaller values will increase 'smoothness' up to a point though at a cost of performance and in creating more vertices to construct the arc. The default ArcTolerance is 0.25 units. This means that the maximum distance the flattened path will deviate from the 'true' arc will be no more than 0.25 units (before rounding). Reducing tolerances below 0.25 will not improve smoothness since vertex coordinates will still be rounded to integer values. The only way to achieve sub-integer precision is through coordinate scaling before and after offsetting (see example below). It's important to make ArcTolerance a sensible fraction of the offset delta (arc radius) . Large tolerances relative to the offset delta will produce poor arc approximations but, just as importantly, very small tolerances will substantially slow offsetting performance while providing unnecessary degrees of precision. This is most likely to be an issue when offsetting polygons whose coordinates have been scaled to preserve floating point precision. Example: Imagine a set of polygons (defined in floating point coordinates) that is to be offset by 10 units using round joins, and the solution is to retain floating point precision up to at least 6 decimal places. To preserve this degree of floating point precision, and given that Clipper and ClipperOffset both operate on integer coordinates, the polygon coordinates will be scaled up by 108
+ (and rounded to integers) prior to offsetting. Both offset delta and ArcTolerance will also need to be scaled by this same factor. If ArcTolerance was left unscaled at the default 0.25 units, every arc in the solution would contain a fraction of 44 THOUSAND vertices while the final arc imprecision would be 0.25 × 10-8
+ units (ie once scaling was reversed). However, if 0.1 units was an acceptable imprecision in the final unscaled solution, then ArcTolerance should be set to 0.1 × scaling_factor (0.1 × 108
+ ). Now if scaling is applied equally to both ArcTolerance and to Delta Offset, then in this example the number of vertices (steps) defining each arc would be a fraction of 23. The formula for the number of steps in a full circular arc is ... Pi / acos(1 - arc_tolerance / abs(delta))
+
+ See Also
+ offset_triginometry2
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/MiterLimit.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/MiterLimit.htm
new file mode 100644
index 0000000..3bdf826
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/MiterLimit.htm
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MiterLimit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset.MiterLimit
+
+
+ property MiterLimit: double;
+
+ double MiterLimit;
+
+ public double MiterLimit {get; set;}
+
+
+
+ This property sets the maximum distance in multiples of delta that vertices can be offset from their original positions before squaring is applied. (Squaring truncates a miter by 'cutting it off' at 1 × delta distance from the original vertex.) The default value for MiterLimit is 2 (ie twice delta). This is also the smallest MiterLimit that's allowed. If mitering was unrestricted (ie without any squaring), then offsets at very acute angles would generate unacceptably long 'spikes'. An example of an offsetting 'spike' at a narrow angle that's a consequence of using a large MiterLimit (25) ...
+
+
+
+ See Also
+ JoinType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/_Body.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/_Body.htm
new file mode 100644
index 0000000..337ed71
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/_Body.htm
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperOffset
+
+
+ The ClipperOffset class encapsulates the process of offsetting (inflating/deflating) both open and closed paths using a number of different join types and end types. (This class replaces the now deprecated OffsetPaths function which was less flexible.) Preconditions for offsetting: 1. The orientations of closed paths must be consistent such that outer polygons share the same orientation, and any holes have the opposite orientation (ie non-zero filling). Open paths must be oriented with closed outer polygons. 2. Polygons must not self-intersect. Limitations: When offsetting, small artefacts may appear where polygons overlap. To avoid these artefacts, offset overlapping polygons separately.
+
+
+
+
+
+
+#include "clipper.hpp"
+...
+using namespace ClipperLib;
+
+int main()
+{
+ Path subj;
+ Paths solution;
+ subj <<
+ IntPoint(348,257) << IntPoint(364,148) << IntPoint(362,148) <<
+ IntPoint(326,241) << IntPoint(295,219) << IntPoint(258,88) <<
+ IntPoint(440,129) << IntPoint(370,196) << IntPoint(372,275);
+ ClipperOffset co;
+ co.AddPath(subj, jtRound, etClosedPolygon);
+ co.Execute(solution, -7.0);
+
+ //draw solution ...
+ DrawPolygons(solution, 0x4000FF00, 0xFF009900);
+}
+
+
+
+
+
+
+
+
+ Reference
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Methods/GetNext.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Methods/GetNext.htm
new file mode 100644
index 0000000..973c8bc
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Methods/GetNext.htm
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GetNext
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode.GetNext
+
+
+ function GetNext: TPolyNode;
+
+ PolyNode* GetNext();
+
+ public PolyNode GetNext();
+
+
+ The returned Polynode will be the first child if any, otherwise the next sibling, otherwise the next sibling of the Parent etc. A PolyTree can be traversed very easily by calling GetFirst() followed by GetNext() in a loop until the returned object is a null pointer ...
+
+
+
+
+
+
+ PolyTree polytree;
+ //call to Clipper.Execute method here which fills 'polytree'
+
+ PolyNode* polynode = polytree.GetFirst();
+ while (polynode)
+ {
+ //do stuff with polynode here
+
+ polynode = polynode->GetNext();
+ }
+
+
+
+
+
+
+
+
+
+
+ See Also
+ PolyTree.GetFirst
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/ChildCount.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/ChildCount.htm
new file mode 100644
index 0000000..4cff1f3
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/ChildCount.htm
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ChildCount
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode.ChildCount
+
+
+ property ChildCount: Integer;
+
+ ChildCount();
+
+ public int ChildCount;
+
+
+
+ Returns the number of PolyNode Childs directly owned by the PolyNode object.
+
+
+ See Also
+ Childs
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Childs.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Childs.htm
new file mode 100644
index 0000000..92e68c4
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Childs.htm
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Childs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode.Childs
+
+
+ property Childs[index: Integer]: TPolyNode;
+
+ std:: vector < PolyNode* > Childs;
+
+ public List < PolyNode > Childs;
+
+
+ A read-only list of PolyNode. Outer PolyNode childs contain hole PolyNodes, and hole PolyNode childs contain nested outer PolyNodes.
+
+
+
+
+ See Also
+ ChildCount
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Contour.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Contour.htm
new file mode 100644
index 0000000..cd4c161
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Contour.htm
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Contour
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode.Contour
+
+ property Contour: TPath;
+
+ Path Contour;
+
+ public Path Contour;
+
+
+ Returns a path list which contains any number of vertices.
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/IsHole.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/IsHole.htm
new file mode 100644
index 0000000..fb1375d
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/IsHole.htm
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IsHole
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode.IsHole
+
+
+ IsHole: Boolean;
+
+ bool IsHole;
+
+ public bool IsHole;
+
+
+ Returns true when the PolyNode's polygon (Contour ) is a hole . Children of outer polygons are always holes , and children of holes are always (nested) outer polygons. The IsHole property of a PolyTree object is undefined but its children are always top-level outer polygons.
+
+ See Also
+ Overview , Contour , PolyTree
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/IsOpen.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/IsOpen.htm
new file mode 100644
index 0000000..be9886d
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/IsOpen.htm
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IsOpen
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode.IsOpen
+
+
+ IsOpen: Boolean;
+
+ bool IsOpen;
+
+ public bool IsOpen;
+
+
+ Returns true when the PolyNode's Contour results from a clipping operation on an open contour (path). Only top-level PolyNodes can contain open contours.
+
+ See Also
+ Contour
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Parent.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Parent.htm
new file mode 100644
index 0000000..ae17bf5
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/Properties/Parent.htm
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Parent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode.Parent
+
+ Parent: TPolyNode;
+
+ PolyNode* Parent;
+
+ public PolyNode Parent;
+
+
+ Returns the parent PolyNode. The PolyTree object (which is also a PolyNode) does not have a parent and will return a null pointer.
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/_Body.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/_Body.htm
new file mode 100644
index 0000000..9f6eb0f
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyNode/_Body.htm
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyNode
+
+
+ PolyNodes are encapsulated within a PolyTree container, and together provide a data structure representing the parent-child relationships of polygon contours returned by Clipper's Execute method. A PolyNode object represents a single polygon. Its IsHole property indicates whether it's an outer or a hole . PolyNodes may own any number of PolyNode children (Childs ), where children of outer polygons are holes, and children of holes are (nested) outer polygons.
+
+ Reference
+
+ See Also
+ Overview , Clipper.Execute , PolyTree
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Methods/Clear.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Methods/Clear.htm
new file mode 100644
index 0000000..d30fb15
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Methods/Clear.htm
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clear
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyTree.Clear
+
+
+ procedure Clear;
+
+ void Clear();
+
+ public void Clear();
+
+
+
+ This method clears any PolyNode children contained by PolyTree the object. Clear does not need to be called explicitly. The Clipper.Execute method that accepts a PolyTree parameter will automatically clear the PolyTree object before propagating it with new PolyNodes. Likewise, PolyTree's destructor will also automatically clear any contained PolyNodes.
+
+ See Also
+ Clipper.Execute
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Methods/GetFirst.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Methods/GetFirst.htm
new file mode 100644
index 0000000..27011d4
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Methods/GetFirst.htm
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GetFirst
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyTree.GetFirst
+
+
+ function GetFirst: TPolyNode;
+
+ PolyNode* GetFirst();
+
+ public PolyNode GetFirst();
+
+
+ This method returns the first outer polygon contour if any, otherwise a null pointer. This function is almost equivalent to calling Childs[0] except that when a PolyTree object is empty (has no children), calling Childs[0] would raise an out of range exception.
+
+
+
+
+
+
+ See Also
+ PolyNode.GetNext , PolyNode.ChildCount , PolyNode.Childs
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Properties/Total.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Properties/Total.htm
new file mode 100644
index 0000000..7a6efe2
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/Properties/Total.htm
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Total
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyTree.Total
+
+
+ property Total: Integer;
+
+ Total();
+
+ public int Total;
+
+
+
+ Returns the total number of PolyNodes (polygons) contained within the PolyTree. This value is not to be confused with ChildCount which returns the number of immediate children only (Childs ) contained by PolyTree.
+
+
+ See Also
+ PolyNode.ChildCount , PolyNode.Childs
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/_Body.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/_Body.htm
new file mode 100644
index 0000000..175df23
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Classes/PolyTree/_Body.htm
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyTree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyTree
+ Hierarchy
+
+ |
+ PolyNode
+
+
+ PolyTree is intended as a read-only data structure that should only be used to receive solutions from clipping and offsetting operations. It's an alternative to the Paths data structure which also receives these solutions. PolyTree's two major advantages over the Paths structure are: it properly represents the parent-child relationships of the returned polygons; it differentiates between open and closed paths. However, since PolyTree is a more complex structure than the Paths structure, and since it's more computationally expensive to process (the Execute method being roughly 5-10% slower), it should used only be when parent-child polygon relationships are needed, or when open paths are being 'clipped'. An empty PolyTree object can be passed as the solution parameter in Clipper.Execute and in ClipperOffset.Execute . Once the clipping or offseting operation is completed, the method returns with the PolyTree structure filled with data representing the solution. A PolyTree object is a container for any number of PolyNode children, with each contained PolyNode representing a single polygon contour (either an outer or hole polygon). PolyTree itself is a specialized PolyNode whose immediate children represent the top-level outer polygons of the solution. (Its own Contour property is always empty.) The contained top-level PolyNodes may contain their own PolyNode children representing hole polygons that may also contain children representing nested outer polygons etc. Children of outers will always be holes , and children of holes will always be outers . PolyTrees can also contain open paths. Open paths will always be represented by top level PolyNodes. Two functions are provided to quickly separate out open and closed paths from a polytree - OpenPathsFromPolyTree and ClosedPathsFromPolyTree .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ polytree:
+ Contour = ()
+ ChildCount = 1
+ Childs[0]:
+ Contour = ((10,10),(100,10),(100,100),(10,100))
+ IsHole = False
+ ChildCount = 1
+ Childs[0]:
+ Contour = ((20,20),(20,90),(90,90),(90,20))
+ IsHole = True
+ ChildCount = 2
+ Childs[0]:
+ Contour = ((30,30),(50,30),(50,50),(30,50))
+ IsHole = False
+ ChildCount = 0
+ Childs[1]:
+ Contour = ((60,60),(80,60),(80,80),(60,80))
+ IsHole = False
+ ChildCount = 0
+
+
+
+
+
+
+
+
+
+ Reference
+
+ See Also
+ Overview , Clipper.Execute , ClipperOffset.Execute , PolyNode , ClosedPathsFromPolyTree , OpenPathsFromPolyTree , Paths
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/Area.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/Area.htm
new file mode 100644
index 0000000..be30baf
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/Area.htm
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Area
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Area
+
+
+ function Area(const pts: TPath ): double;
+
+ double Area(const Path &poly);
+
+ public static double Area(Path poly);
+
+
+ This function returns the area of the supplied polygon. It's assumed that the path is closed and does not self-intersect. Depending on orientation , this value may be positive or negative. If Orientation is true, then the area will be positive and conversely, if Orientation is false, then the area will be negative.
+
+
+
+ See Also
+ Orientation , Path
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/CleanPolygon.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/CleanPolygon.htm
new file mode 100644
index 0000000..5a857fe
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/CleanPolygon.htm
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CleanPolygon
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CleanPolygon
+
+
+ function CleanPolygon(const Poly: TPath; Distance: double = 1.415): TPath;
+
+ void CleanPolygon(const Path &in_poly, Path &out_poly, double distance = 1.415);
+
+ void CleanPolygon(Path &poly, double distance = 1.415);
+
+ public static Path CleanPolygon(Path poly, double distance = 1.415);
+
+
+
+ Removes vertices:
+
+
+ that join co-linear edges, or join edges that are almost co-linear (such that if the vertex was moved no more than the specified distance the edges would be co-linear)
+
+ that are within the specified distance of an adjacent vertex
+
+ that are within the specified distance of a semi-adjacent vertex together with their out-lying vertices
+
+
+
+ Vertices are semi-adjacent when they are separated by a single (out-lying) vertex. The distance parameter's default value is approximately √2 so that a vertex will be removed when adjacent or semi-adjacent vertices having their corresponding X and Y coordinates differing by no more than 1 unit. (If the egdes are semi-adjacent the out-lying vertex will be removed too.) C++ only: This function is overloaded. In the first definition, the in_poly and out_poly parameters can reference the same Path object though in that case the calling code might be clearer if the second definition (accepting a single Paths parameter) is used.
+
+
+
+
+
+ See Also
+ CleanPolygons , SimplifyPolygon , Path
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/CleanPolygons.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/CleanPolygons.htm
new file mode 100644
index 0000000..7ec56ed
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/CleanPolygons.htm
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CleanPolygons
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CleanPolygons
+
+
+ function CleanPolygons(const Polys: TPaths; Distance: double = 1.415): TPaths;
+
+ void CleanPolygons(const Paths &in_polys, Paths &out_polys, double distance = 1.415);
+
+ void CleanPolygons(Paths &polys, double distance = 1.415);
+
+ public static Paths CleanPolygons(Paths polys, double distance = 1.415);
+
+
+
+ Removes vertices:
+
+
+ that join co-linear edges, or join edges that are almost co-linear (such that if the vertex was moved no more than the specified distance the edges would be co-linear)
+
+ that are within the specified distance of an adjacent vertex
+
+ that are within the specified distance of a semi-adjacent vertex together with their out-lying vertices
+
+
+
+ Vertices are semi-adjacent when they are separated by a single (out-lying) vertex. The distance parameter's default value is approximately √2 so that a vertex will be removed when adjacent or semi-adjacent vertices having their corresponding X and Y coordinates differing by no more than 1 unit. (If the egdes are semi-adjacent the out-lying vertex will be removed too.) C++ only: This function is overloaded. In the first definition, the in_polys and out_polys parameters can reference the same Paths object though in that case the calling code might be clearer if the second definition (accepting a single Paths parameter) is used.
+
+
+
+
+ See Also
+ CleanPolygon , SimplifyPolygons
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ClosedPathsFromPolyTree.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ClosedPathsFromPolyTree.htm
new file mode 100644
index 0000000..e050135
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ClosedPathsFromPolyTree.htm
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClosedPathsFromPolyTree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClosedPathsFromPolyTree
+
+
+ function ClosedPathsFromPolyTree(PolyTree: TPolyTree): TPaths;
+
+ void ClosedPathsFromPolyTree(PolyTree& polytree, Paths& paths);
+
+ public static void ClosedPathsFromPolyTree(PolyTree polytree, Paths paths);
+
+
+
+ This function filters out open paths from the PolyTree structure and returns only closed paths in a Paths structure.
+
+ See Also
+ PolyTree , Paths
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/MinkowskiDiff.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/MinkowskiDiff.htm
new file mode 100644
index 0000000..0a3ee4b
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/MinkowskiDiff.htm
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MinkowskiDiff
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MinkowskiDiff
+
+
+ function MinkowskiDiff(const Poly1: TPath; const Poly2: TPath): TPaths;
+
+ void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
+
+ public static Paths MinkowskiDiff(Path poly1, Path poly2);
+
+
+
+ Minkowski Difference is performed by subtracting each point in a polygon from the set of points in an open or closed path. A key feature of Minkowski Difference is that when it's applied to two polygons, the resulting polygon will contain the coordinate space origin whenever the two polygons touch or overlap. (This function is often used to determine when polygons collide.) In the image on the left the blue polygon is the 'minkowski difference' of the two red boxes. The black dot represents the coordinate space origin.
+
+
+
+
+ See Also
+ MinkowskiSum , Path
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/MinkowskiSum.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/MinkowskiSum.htm
new file mode 100644
index 0000000..0d4429d
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/MinkowskiSum.htm
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MinkowskiSum
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MinkowskiSum
+
+
+ function MinkowskiSum(const Pattern: TPath; const Path: TPath; PathIsClosed: Boolean): TPaths; overload;
+
+ function MinkowskiSum(const Pattern: TPath; const Paths: TPaths; PathFillType: TPolyFillType; PathIsClosed: Boolean): TPaths; overload;
+
+ void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed);
+
+ void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, PolyFillType pathFillType, bool pathIsClosed);
+
+ public static Paths MinkowskiSum(Path pattern, Path path, bool pathIsClosed);
+
+ public static Paths MinkowskiSum(Path pattern, Paths paths, PolyFillType pathFillType, bool pathIsClosed);
+
+
+
+ Minkowski Addition is performed by adding each point in a polygon 'pattern' to the set of points in an open or closed path. The resulting polygon (or polygons) defines the region that the 'pattern' would pass over in moving from the beginning to the end of the 'path'.
+
+
+
+
+ Path path = new Path();
+ Path pattern = new Path();
+ Paths solution = new Paths();
+
+ //Greek capital sigma (sum sign) ...
+ Int64[] ints1 = new Int64[] { 300, 400, 100, 400, 200, 300, 100, 200, 300, 200 };
+ path = IntsToPolygon(ints1);
+
+ //diagonal brush pattern ...
+ Int64[] ints2 = new Int64[] { 4, -6, 6, -6, -4, 6, -6, 6 };
+ pattern = IntsToPolygon(ints2);
+
+ solution = Clipper.MinkowskiSum(pattern, path, false);
+ //move 'pattern' to the end of 'path' ...
+ pattern = TranslatePath(pattern, 300, 200);
+
+ //Display solution ± pattern ...
+
+
+
+
+ See Also
+ MinkowskiDiff
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/OffsetPaths.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/OffsetPaths.htm
new file mode 100644
index 0000000..a0787b7
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/OffsetPaths.htm
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OffsetPaths
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OffsetPaths
+
+
+ function OffsetPaths(const polys: Paths; const delta: double; JoinType: TJoinType = jtSquare; EndType: TEndType = etClosed; Limit: double = 0.0): TPaths;
+
+ void OffsetPaths(const Paths &in_polys, Paths &out_polys, double delta, JoinType jointype = jtSquare, EndType endtype = etClosed, double limit = 0.0);
+
+ public static Paths OffsetPaths(Paths polys, double delta, JoinType jointype = JoinType.jtSquare, EndType endtype = EndType.etClosed, double limit = 0.0);
+
+
+ Deprecated. (See ClipperOffset .)
+
+ See Also
+ ClipperOffset
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/OpenPathsFromPolyTree.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/OpenPathsFromPolyTree.htm
new file mode 100644
index 0000000..3ce9fa9
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/OpenPathsFromPolyTree.htm
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OpenPathsFromPolyTree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OpenPathsFromPolyTree
+
+
+ function OpenPathsFromPolyTree(PolyTree: TPolyTree): TPaths;
+
+ void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
+
+ public static void OpenPathsFromPolyTree(PolyTree polytree, Paths paths);
+
+
+
+ This function filters out closed paths from the PolyTree structure and returns only open paths in a Paths structure.
+
+ See Also
+ PolyTree , Paths
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/Orientation.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/Orientation.htm
new file mode 100644
index 0000000..6dc02c9
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/Orientation.htm
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Orientation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Orientation
+
+
+ function Orientation(const poly: TPath ): boolean;
+
+ bool Orientation(const Path &poly);
+
+ public static bool Orientation(Path poly);
+
+
+ Orientation is only important to closed paths. Given that vertices are declared in a specific order, orientation refers to the direction (clockwise or counter-clockwise) that these vertices progress around a closed path. Orientation is also dependent on axis direction:
+
+
+ On Y-axis positive upward displays , Orientation will return true if the polygon's orientation is counter-clockwise.
+
+ On Y-axis positive downward displays , Orientation will return true if the polygon's orientation is clockwise.
+
+
+
+
+ Notes:
+
+
+ Self-intersecting polygons have indeterminate orientations in which case this function won't return a meaningful value.
+
+ The majority of 2D graphic display libraries (eg GDI, GDI+, XLib, Cairo, AGG, Graphics32) and even the SVG file format have their coordinate origins at the top-left corner of their respective viewports with their Y axes increasing downward . However, some display libraries (eg Quartz, OpenGL) have their coordinate origins undefined or in the classic bottom-left position with their Y axes increasing upward.
+
+ For Non-Zero filled polygons, the orientation of holes must be opposite that of outer polygons.
+
+ For closed paths (polygons) in the solution returned by Clipper's Execute method, their orientations will always be true for outer polygons and false for hole polygons (unless the ReverseSolution property has been enabled).
+
+
+
+
+ See Also
+ Overview , Clipper.ReverseSolution , Path
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/PointInPolygon.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/PointInPolygon.htm
new file mode 100644
index 0000000..6ae3214
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/PointInPolygon.htm
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PointInPolygon
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PointInPolygon
+
+
+ function PointInPolygon(const Pt: TIntPoint ; const poly: TPath ): Integer;
+
+ int PointInPolygon(const IntPoint pt, const Path &poly);
+
+ public static int PointInPolygon(IntPoint pt, Path poly);
+
+
+ Returns 0 when false, -1 when pt is on poly and +1 when pt is in poly. It's assumed that 'poly' is closed and does not self-intersect.
+
+
+
+ See Also
+ IntPoint , Path
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/PolyTreeToPaths.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/PolyTreeToPaths.htm
new file mode 100644
index 0000000..a4762d2
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/PolyTreeToPaths.htm
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyTreeToPaths
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyTreeToPaths
+
+
+ function PolyTreeToPaths(PolyTree: TPolyTree): TPaths;
+
+ void PolyTreeToPaths(PolyTree& polytree, Paths& paths);
+
+ public static Paths PolyTreeToPaths(PolyTree polytree);
+
+
+
+ This function converts a PolyTree structure into a Paths structure.
+
+ See Also
+ PolyTree , Paths
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ReversePath.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ReversePath.htm
new file mode 100644
index 0000000..d0fe8ec
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ReversePath.htm
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ReversePath
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ReversePath
+
+
+ function ReversePath(const polys: TPath): TPath;
+
+ void ReversePath(const Path &p);
+
+
+
+
+ Reverses the vertex order (and hence orientation) in the specified path.
+
+
+ See Also
+ Path
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ReversePaths.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ReversePaths.htm
new file mode 100644
index 0000000..19ebbad
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/ReversePaths.htm
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ReversePaths
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ReversePaths
+
+
+ function ReversePaths(const p: TPaths): TPaths;
+
+ void ReversePaths(const Paths &p);
+
+ void ReversePaths( Paths p );
+
+
+
+ Reverses the vertex order (and hence orientation) in each contained path.
+
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/SimplifyPolygon.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/SimplifyPolygon.htm
new file mode 100644
index 0000000..3462f82
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/SimplifyPolygon.htm
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SimplifyPolygon
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SimplifyPolygon
+
+
+ function SimplifyPolygon(const Poly: TPath; FillType: TPolyFillType = pftEvenOdd): TPaths;
+
+ void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
+
+ public static Paths SimplifyPolygon(Path poly, PolyFillType fillType = PolyFillType.pftEvenOdd);
+
+
+
+ Removes self-intersections from the supplied polygon (by performing a boolean union operation using the nominated PolyFillType ). Polygons with non-contiguous duplicate vertices (ie 'touching') will be split into two polygons. Note: There's currently no guarantee that polygons will be strictly simple since 'simplifying' is still a work in progress.
+
+
+
+
+
+ See Also
+ Clipper.StrictlySimple , CleanPolygon , Path , PolyFillType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/SimplifyPolygons.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/SimplifyPolygons.htm
new file mode 100644
index 0000000..69c791b
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Functions/SimplifyPolygons.htm
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SimplifyPolygons
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SimplifyPolygons
+
+
+ function SimplifyPolygons(const polys: TPaths; FillType: TPolyFillType = pftEvenOdd): TPaths;
+
+ void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
+
+ void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd);
+
+ public static Polygons SimplifyPolygons(Paths polys, PolyFillType fillType = PolyFillType.pftEvenOdd);
+
+
+
+ Removes self-intersections from the supplied polygons (by performing a boolean union operation using the nominated PolyFillType ). Polygons with non-contiguous duplicate vertices (ie 'vertices are touching') will be split into two polygons. C++ only: This function is overloaded. In the first definition, the in_polys and out_polys parameters can reference the same Paths object though in that case the calling code might be clearer if the second definition (accepting a single Paths parameter) is used. Note: There's currently no guarantee that polygons will be strictly simple since 'simplifying' is still a work in progress.
+
+
+
+
+ See Also
+ Clipper.StrictlySimple , CleanPolygons , PolyFillType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/CInt.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/CInt.htm
new file mode 100644
index 0000000..1af7f15
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/CInt.htm
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CInt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CInt
+
+
+ Del.» {$IFDEF use_int32} cInt = Int32; {$ELSE} cInt = Int64; {$ENDIF}
+
+ C++ » #ifdef use_int32 typedef int cInt; #else typedef signed long long cInt; #endif
+
+ C# » #if use_int32 using cInt = Int32; #else using cInt = Int64; #endif
+
+
+ cInt is the integer type used by the Clipper Library to represent vertex coordinate values. (See also IntPoint .) The library uses integers instead of floating point values to preserve numerical robustness . (Very early versions of the library used floating point coordinates, but it became apparent that floating point imprecision was always going to cause occasional errors.) By default cInt represents a signed 64bit integer and polygon coordinates can have any value in the range ± 9.2e+18. This accommodates the scaling of floating point coordinate values to very large integers so that very high degrees of precision can be retained during clipping. However, if coordinate values can be kept within the range ± 3.0e+9, then by avoiding large integer math, a modest ~10% improvement in clipping performance is achieved. If the preprocessor directive use_int32 is defined, cInt will represent a signed 32bit integer. This improves clipping performance by 20-30% but the trade-off is that coordinate values are restricted to the much narrower range of ± 46340.
+
+ See Also
+ Defines , IntPoint
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/ClipType.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/ClipType.htm
new file mode 100644
index 0000000..aabc455
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/ClipType.htm
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipType
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipType
+
+
+ type TClipType = (ctIntersection, ctUnion, ctDifference, ctXor);
+
+ enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
+
+ public enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
+
+
+
+ There are four boolean operations - AND, OR, NOT & XOR. Given that subject and clip polygon brush 'filling' is defined both by their vertices and their respective filling rules , the four boolean operations can be applied to polygons to define new filling regions:
+
+
+ AND (intersection) - create regions where both subject and clip polygons are filled
+
+ OR (union) - create regions where either subject or clip polygons (or both) are filled
+
+ NOT (difference) - create regions where subject polygons are filled except where clip polygons are filled
+
+ XOR (exclusive or) - create regions where either subject or clip polygons are filled but not where both are filled
+
+
+
+
+ All polygon clipping is performed with a Clipper object with the specific boolean operation indicated by the ClipType parameter passed in its Execute method.
+
+
+ With regard to open paths (polylines), clipping rules generally match those of closed paths (polygons). However, when there are both polyline and polygon subjects, the following clipping rules apply:
+
+
+ union operations - polylines will be clipped by any overlapping polygons so that non-overlapped portions will be returned in the solution together with the union-ed polygons
+
+ intersection, difference and xor operations - polylines will be clipped only by 'clip' polygons and there will be not interaction between polylines and subject polygons.
+
+
+
+
+ Example of clipping behaviour when mixing polyline and polygon subjects:
+
+
+
+ See Also
+ Overview , Clipper , Clipper.Execute , PolyFillType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/EndType.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/EndType.htm
new file mode 100644
index 0000000..3c1f21d
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/EndType.htm
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ EndType
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ EndType
+
+ type TEndType = (etClosedPolygon, etClosedLine, etOpenSquare, etOpenRound, etOpenButt);
+
+ enum EndType {etClosedPolygon, etClosedLine, etOpenSquare, etOpenRound, etOpenButt};
+
+ public enum EndType {etClosedPolygon, etClosedLine, etOpenSquare, etOpenRound, etOpenButt};
+
+
+ The EndType enumerator has 5 values:
+
+
+ etClosedPolygon: Ends are joined using the JoinType value and the path filled as a polygon
+
+ etClosedLine: Ends are joined using the JoinType value and the path filled as a polyline
+
+ etOpenSquare: Ends are squared off and extended delta units
+
+ etOpenRound: Ends are rounded off and extended delta units
+
+ etOpenButt: Ends are squared off with no extension.
+
+ etOpenSingle: Offsets an open path in a single direction. Planned for a future update.
+
+
+
+
+ Note: With etClosedPolygon and etClosedLine types, the path closure will be the same regardless of whether or not the first and last vertices in the path match.
+
+
+ See Also
+ ClipperOffset.AddPath , ClipperOffset.AddPaths
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/InitOptions.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/InitOptions.htm
new file mode 100644
index 0000000..0c41d2a
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/InitOptions.htm
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ InitOptions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ InitOptions
+
+
+ type TInitOption = (ioReverseSolution, ioStrictlySimple, ioPreserveCollinear);
+
+ enum InitOptions { ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4};
+
+ public const int ioReverseSolution = 1; public const int ioStrictlySimple = 2; public const int ioPreserveCollinear = 4;
+
+
+
+
+
+
+
+
+
+ See Also
+ Clipper.Constructor , Clipper.PreserveCollinear , Clipper.ReverseSolution , Clipper.StrictlySimple
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/IntPoint.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/IntPoint.htm
new file mode 100644
index 0000000..7fbb7ff
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/IntPoint.htm
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IntPoint
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IntPoint
+
+ TIntPoint = record X, Y: cInt ; end;
+
+ struct IntPoint { cInt X; cInt Y; ... };
+
+ public class IntPoint { public cInt X; { get; set; } public cInt Y; { get; set; } ... };
+
+
+
+ The IntPoint structure is used to represent all vertices in the Clipper Library. An integer storage type has been deliberately chosen to preserve numerical robustness . (Early versions of the library used floating point coordinates, but it became apparent that floating point imprecision would always cause occasional errors.) A sequence of IntPoints are contained within a Path structure to represent a single contour. As of version 6, IntPoint now has an optional third member 'Z' . This can be enabled by exposing (ie uncommenting) the PreProcessor define 'use_xyz '. When the Z member is used, its values will be copied to corresponding verticies in solutions to clipping operations. However, at points of intersection where there's no corresponding Z value, the value will be assigned zero unless a new value is provided by a user supplied callback function . Users wishing to clip or offset polygons containing floating point coordinates need to use appropriate scaling when converting these values to and from IntPoints . See also the notes on rounding .
+
+
+
+
+ See Also
+ Rounding , Clipper.ZFillFunction , Defines , CInt , Path , Paths
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/IntRect.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/IntRect.htm
new file mode 100644
index 0000000..baaa12b
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/IntRect.htm
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IntRect
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IntRect
+
+ TIntRect = record left, top, right, bottom: cInt ; end;
+
+ struct IntRect { cInt left; cInt top; cInt right; cInt bottom; ... };
+
+ public class IntRect { public cInt left; { get; set; } public cInt top; { get; set; } public cInt right; { get; set; } public cInt bottom; { get; set; } ... };
+
+ Structure returned by Clipper's GetBounds method.
+
+
+ See Also
+ ClipperBase.GetBounds , CInt
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/JoinType.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/JoinType.htm
new file mode 100644
index 0000000..1820138
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/JoinType.htm
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JoinType
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JoinType
+
+ type TJoinType = (jtSquare, jtRound, jtMiter);
+
+ enum JoinType {jtSquare, jtRound, jtMiter};
+
+ public enum JoinType {jtSquare, jtRound, jtMiter};
+
+
+ When adding paths to a ClipperOffset object via the AddPaths method, the joinType parameter may be one of three types - jtMiter, jtSquare or jtRound.
+
+
+ jtMiter: There's a necessary limit to mitered joins since offsetting edges that join at very acute angles will produce excessively long and narrow 'spikes'. To contain these potential spikes, the ClippOffset object's MiterLimit property specifies a maximum distance that vertices will be offset (in multiples of delta) . For any given edge join, when miter offsetting would exceed that maximum distance, 'square' joining is applied.
+
+ jtRound: While flattened paths can never perfectly trace an arc, they are approximated by a series of arc chords (see ClipperObject's ArcTolerance property).
+
+ jtSquare: Squaring is applied uniformally at all convex edge joins at 1 × delta.
+
+
+
+ See Also
+ ClipperOffset , ClipperOffset.AddPaths , ClipperOffset.ArcTolerance , ClipperOffset.MiterLimit
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/Path.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/Path.htm
new file mode 100644
index 0000000..f4d8748
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/Path.htm
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Path
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Path
+
+ TPath = array of TIntPoint;
+
+ typedef std::vector<IntPoint> Path;
+
+ using Path = List<IntPoint>;
+
+
+ This structure contains a sequence of IntPoint vertices defining a single contour (see also terminology ). Paths may be open and represent a series of line segments bounded by 2 or more vertices, or they may be closed and represent polygons. Whether or not a path is open depends on context. Closed paths may be 'outer ' contours or 'hole ' contours. Which they are depends on orientation. Multiple paths can be grouped into a Paths structure.
+
+ See Also
+ Overview , Example , ClipperBase.AddPath , PolyTree , Orientation , IntPoint , Paths
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/Paths.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/Paths.htm
new file mode 100644
index 0000000..417b069
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/Paths.htm
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Paths
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Paths
+
+
+ TPaths = array of TPath ;
+
+ typedef std::vector< Path > Paths;
+
+ using Paths = List<List< IntPoint >>;
+
+
+ This structure is fundamental to the Clipper Library. It's a list or array of one or more Path structures. (The Path structure contains an ordered list of vertices that make a single contour.) Paths may open (a series of line segments), or they may closed (polygons). Whether or not a path is open depends on context. Closed paths may be 'outer ' contours or 'hole ' contours. Which they are depends on orientation.
+
+
+
+
+
+
+
+ See Also
+ Clipper.Execute , ClipperBase.AddPath , ClipperBase.AddPaths , OffsetPaths , IntPoint , Path
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/PolyFillType.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/PolyFillType.htm
new file mode 100644
index 0000000..7a2f93d
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/PolyFillType.htm
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyFillType
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyFillType
+
+
+ type TPolyFillType = (pftEvenOdd, pftNonZero, pftPositive, pftNegative);
+
+ enum PolyFillType {pftEvenOdd, pftNonZero, pftPositive, pftNegative};
+
+ public enum PolyFillType {pftEvenOdd, pftNonZero, pftPositive, pftNegative};
+
+
+
+ Filling indicates those regions that are inside a closed path (ie 'filled' with a brush color or pattern in a graphical display) and those regions that are outside . The Clipper Library supports 4 filling rules: Even-Odd, Non-Zero, Positive and Negative. The simplest filling rule is Even-Odd filling (sometimes called alternate filling). Given a group of closed paths start from a point outside the paths and progress along an imaginary line through the paths. When the first path is crossed the encountered region is filled. When the next path is crossed the encountered region is not filled. Likewise, each time a path is crossed, filling starts if it had stopped and stops if it had started. With the exception of Even-Odd filling, all other filling rules rely on edge direction and winding numbers to determine filling. Edge direction is determined by the order in which vertices are declared when constructing a path. Edge direction is used to determine the winding number of each polygon subregion. The winding number for each polygon sub-region can be derived by:
+
+ starting with a winding number of zero and
+
+ from a point (P1) that's outside all polygons, draw an imaginary line to a point that's inside a given sub-region (P2)
+
+ while traversing the line from P1 to P2, for each path that crosses the imaginary line from right to left increment the winding number, and for each path that crosses the line from left to right decrement the winding number.
+
+ Once you arrive at the given sub-region you have its winding number.
+
+
+
+ Even-Odd (Alternate) : Odd numbered sub-regions are filled, while even numbered sub-regions are not. Non-Zero (Winding) : All non-zero sub-regions are filled. Positive : All sub-regions with winding counts > 0 are filled. Negative : All sub-regions with winding counts < 0 are filled. Paths are added to a Clipper object using the AddPath or AddPaths methods and the filling rules (for subject and clip polygons separately) are specified in the Execute method. Polygon regions are defined by one or more closed paths which may or may not intersect. A single polygon region can be defined by a single non-intersecting path or by multiple non-intersecting paths where there's typically an 'outer' path and one or more inner 'hole' paths. Looking at the three shapes in the image above, the middle shape consists of two concentric rectangles sharing the same clockwise orientation. With even-odd filling, where orientation can be disregarded, the inner rectangle would create a hole in the outer rectangular polygon. There would be no hole with non-zero filling. In the concentric rectangles on the right, where the inner rectangle is orientated opposite to the outer, a hole will be rendered with either even-odd or non-zero filling. A single path can also define multiple subregions if it self-intersects as in the example of the 5 pointed star shape below. By far the most widely used fill rules are Even-Odd (aka Alternate) and Non-Zero (aka Winding). Most graphics rendering libraries (AGG , Android Graphics , Cairo , GDI+ , OpenGL , Quartz 2D etc) and vector graphics storage formats (SVG , Postscript, Photoshop etc) support both these rules. However some libraries (eg Java's Graphics2D ) only support one fill rule. Android Graphics and OpenGL are the only libraries (that I'm aware of) that support multiple filling rules. It's useful to note that edge direction has no affect on a winding number's odd-ness or even-ness. (This is why orientation is ignored when the Even-Odd rule is employed.) The direction of the Y-axis does affect polygon orientation and edge direction . However, changing Y-axis orientation will only change the sign of winding numbers, not their magnitudes, and has no effect on either Even-Odd or Non-Zero filling.
+
+ See Also
+ Clipper.Execute , ClipperBase.AddPath , ClipperBase.AddPaths , Orientation
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/PolyType.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/PolyType.htm
new file mode 100644
index 0000000..48fc46c
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/PolyType.htm
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyType
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PolyType
+
+
+ type TPolyType = (ptSubject, ptClip);
+
+ enum PolyType { ptSubject, ptClip };
+
+ public enum PolyType { ptSubject, ptClip };
+
+
+ Boolean (clipping) operations are mostly applied to two sets of Polygons, represented in this library as subject and clip polygons. Whenever Polygons are added to the Clipper object, they must be assigned to either subject or clip polygons. UNION operations can be performed on one set or both sets of polygons, but all other boolean operations require both sets of polygons to derive meaningful solutions.
+
+
+
+
+ See Also
+ ClipperBase.AddPath , ClipperBase.AddPaths , ClipType
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/ZFillCallback.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/ZFillCallback.htm
new file mode 100644
index 0000000..95862c2
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/Types/ZFillCallback.htm
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ZFillCallback
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ZFillCallback
+
+
+ type TZFillCallback = procedure (const E1Bot, E1Top, E2Bot, E2Top: TIntPoint; var Pt: TIntPoint);
+
+ typedef void (*ZFillCallback)(const IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt);
+
+ public delegate void ZFillCallback(IntPoint bot1, IntPoint top1, IntPoint bot2, IntPoint top2, ref IntPoint pt);
+
+
+ If the use_xyz pre-processor directive is enabled, then the IntPoint class will have an extra 'Z' member and the Clipper class's ZFillFunction property will be exposed so it can be assigned a custom callback function. This custom callback procedure requires five IntPoint parameters: the first 2 parameters are the vertices that define one line segment involved in the intersection and the next two parameters the other line segment. (Since the Clipper library has been developed in an environment that uses an inverted Y axis display, e1bot and e2bot will always have Y values greater than or equal to their corresponding e1top and e2top Y values.) The last IntPoint parameter contain the actual coordinates at the intersection. This last parameter is passed by reference so that its Z member can be assigned with a custom value.
+
+
+ See Also
+ Clipper.ZFillFunction , Defines
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/_Body.htm b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/_Body.htm
new file mode 100644
index 0000000..8fd8877
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/Units/ClipperLib/_Body.htm
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperLib
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClipperLib
+
+
+ Filenames: clipper.pas; clipper.hpp and clipper.cpp; clipper.cs Namespace: ClipperLib
+
+
+ Contents
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Docs/_Body.htm b/upstream/clipper-6.4.2/Documentation/Docs/_Body.htm
new file mode 100644
index 0000000..16c5668
--- /dev/null
+++ b/upstream/clipper-6.4.2/Documentation/Docs/_Body.htm
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Graphics32 Help
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The Clipper Library - Version 6
+
+
+
+ Types
+
+ Functions
+
+ Units
+
+
+ Copyright ©2010-2014 Angus Johnson - Clipper 6.2.1 - Help file built on 1-November-2014
+
+
+
+
\ No newline at end of file
diff --git a/upstream/clipper-6.4.2/Documentation/Images/_BranchEmpty.gif b/upstream/clipper-6.4.2/Documentation/Images/_BranchEmpty.gif
new file mode 100644
index 0000000000000000000000000000000000000000..1069e82279c4e33b84d11433ea5082e4c722c9b4
GIT binary patch
literal 56
zcmZ?wbhEHb6krfyXkcJCaNs~gLxbW^7DfgJ1_m7v0g_>0;&16+dHOB?;yGJxb#K16
Ifq}sq0G;y?-~a#s
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/_BranchRight.gif b/upstream/clipper-6.4.2/Documentation/Images/_BranchRight.gif
new file mode 100644
index 0000000000000000000000000000000000000000..e5622df3e94ddeb620098d2185c5637f1844e618
GIT binary patch
literal 62
zcmZ?wbhEHb6krfyXkcJCaNs~gLxbW^7DfgJ1_m7v0g_>05^dpcJpK0PqL$5ism395
OUh%g*@~~rNum%AB_!0^L
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/_BranchVert.gif b/upstream/clipper-6.4.2/Documentation/Images/_BranchVert.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b922f3392524ed54b28b1733de7bea61e04aa434
GIT binary patch
literal 64
zcmZ?wbhEHb6krfyXkcJCaNs~gLxbW^7DfgJ1_m7v0g_>05^v#eJpK0PqL$5ism51D
QKfkOE)Ua9-!N6b*04k#sA^-pY
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/_BranchVertRight.gif b/upstream/clipper-6.4.2/Documentation/Images/_BranchVertRight.gif
new file mode 100644
index 0000000000000000000000000000000000000000..ae0f3d132fe63a1d8dc1e4a9147a6a39ee27a237
GIT binary patch
literal 65
zcmZ?wbhEHb6krfyXkcJCaNs~gLxbW^7DfgJ1_m7v0g_>0l4#*?JpK0PqL$5ism395
RUj2@Y(CB@VJdc&Z8URBk6jlHL
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/_Class.gif b/upstream/clipper-6.4.2/Documentation/Images/_Class.gif
new file mode 100644
index 0000000000000000000000000000000000000000..5e90e3406188f732fe290c001f0dc9864041a528
GIT binary patch
literal 118
zcmZ?wbhEHb6krfwSj52a|Ns9pXU@!=In&tK_`rb!3^1VhlZBCifrUW_Bmh#&z-;ZY
z>&`mGW1ptY5sf?Lbl;bu;)rO0*n)Ykx7$`}O_`{?s#$>J&mBhQQ|pc=v*@}oo|+b8
P)p4%fXx7RoVFqge{QxOn
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/_Home.gif b/upstream/clipper-6.4.2/Documentation/Images/_Home.gif
new file mode 100644
index 0000000000000000000000000000000000000000..7ca8ba222f6b197eb60309a4fc9b2c0cd89b168c
GIT binary patch
literal 125
zcmZ?wbhEHb6krfwSoELa|Ns974jedh=FH5QGZ~P8;!hSv1_nk39grAEtpl@@#I8G5
zDGi?LD!y(S9_f=z1x22*Tr#ie7K@tqGeFVO$YtI8pFd|XpYRlpKA9#M;r?uu#>_1X
TcnfN-dMVuEc>P+9fx#L8*Cs0*
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/_Project_Logo.gif b/upstream/clipper-6.4.2/Documentation/Images/_Project_Logo.gif
new file mode 100644
index 0000000000000000000000000000000000000000..7e3baac56c9956f2ebe6b0b64d0f32548d624213
GIT binary patch
literal 1589
zcmZ?wbhEHbjAM{uXlG#1F4cB$aBy;Rbar-hc5-rcb#ilca(8p_@No9Gwyr!&dZAHcU>go-(wVULot4YpK;9DcezMGqK
z7a#97QJ&p`;!ETOH%kd`kQ3T0Be6ev+FKQq*!Av>liDQ#{@Nn3SUM{Q+SUB#+s
z*OPu>XA|PjXQo`tubb3bdbP2mymVGwNn`$;zS3C}%V$lmnmw(0?(~|u^XupIc85>s
zi&(NKZqtUOt(%e$>`Oa*ApO|kjFZPQuV2Z%dn^CN)1uceir>8|`S`Z<%ZJi$pUOI?
zb6wbz6J;_O7m-Jw3Z7PTV_X%Ko;!6Q}Q9JbTZIxqDVFZERfE*0#2*
zVNt{EmF@G^w#{DOI%7-M>>ZuccJ|EL-8XydfB((Hhi{)f`|$GRr`NAP
zzkB!f!-sF5KmYjp_2-WtzkmJu^Y`z+|Ns9pPy;CbWMO7tuw~Ez83xJ|3>^O%sySpl
zHY_;U%pt55b7BMggf;lw!ym)$7|Xne7dls~UPwDT+ro5R=cgw;tsHGkC6!4}
zot(2@raG7J1Hg(=9lmoB!-kVsh@}
zjx9^L5=}lndU;u$RZYoNs^mcVa$TPcl_za{o=#iRa=n^MQ!ei)_P*q|zRvddgn|bq
zvi}c$c^fln%afc{vK`D*jZ!LWPVpCbSSxaQm{@abW&oRi!6OEy
zmMNM^3XB^*w(xT37W$dze@i%Ga{GX!s^j(r&fRlo=I!FO+PGs!oRhvyA-jPFi$mJX
zCYBFuvi?{8PY}?1;iJ4jclx0WVOUj<`
z_ZE&q#a4aI5(OodudbIo7$$xAbVP!O)v;4&^O++PBAME*IUm(HD$pv)&7pKhQGml!
zg$Q?z=6RU0Bj@400000
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/_Unit.gif b/upstream/clipper-6.4.2/Documentation/Images/_Unit.gif
new file mode 100644
index 0000000000000000000000000000000000000000..ef56412b451ab636e4e5d7b3a406aacfcecd8753
GIT binary patch
literal 171
zcmZ?wbhEHb6krfw*!-V?fq~(`fdjvO{rdd*^Zxz&o0^&$8X9V9YTVr1?Ck91_7|09&H)@-hKG+
z=HrLgZ{I$D^ZMDVmye%3y!rIut;Y{;-oJh6&W-c8ubsJZ`Q-IW$FE&HcInLiOJ@$8
zKe2nmq07hitvkGH)xjOh5A9fSVEeL)8Cw}>1{8m?u!u1HXV3xJ0P+(9TgU<53=bYo
z#uF+D7919H+Y=M5VjbEzCWdKCstNJ5DLYBpsZA|$Gd@yaSFmHF#~qHB#i^4lB|3fu
iDuyVrg+)Zi#3d*trz)n4Dv4+3<`>ErS4cZDSOWm2ig?Tb
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/clean1.png b/upstream/clipper-6.4.2/Documentation/Images/clean1.png
new file mode 100644
index 0000000000000000000000000000000000000000..8caa45b72806cf3646e0fa697f1c93d4bb808379
GIT binary patch
literal 1303
zcmeAS@N?(olHy`uVBq!ia0y~yU=(6tU|7h(%)r24bKpQ70|SFjiEBiOb5UwyNoIbY
zLP%zADuZu+o`R97f^TAxf{}rtv4Vkxm63&&v9W@-p@D(H-`Dy}7#JAXOFVsD+3zw-
zh+4{Q5EPitz`(#+;1OBOz`%DHgc*mi^mSxl*x1kgCy|wbfzdR;C&cyt
z|NjsEKREFJK*RqAhW`xzZ%?qYnsEF7|Nq<47#J8BtR}z&Zcmu74J2wcVS*Jy+P41;
zY1^#QwrxvG1B)_PS*4{}F{CjtY)b>_Ph&`%V3lUYV3o#TWyO$Y#lSGZ%Ig2^+YDA#
zxBuVX_J11#L)!1(zYiWfc=6)JuV25OIdeuzN;WpOJ}RnGPEP6i_3J-={E(MdTCm{5
zs#X8z&V3^$Ci&~vuT!T^#l_Y4G`y+Fe(Y?SGr4}{t_4?JtP7%}tK+4M#S1(={odC;FgR&G`N_P+kO^xA)X__j&ACdvufBIy2|=uM<<(UXeFnR@*vRW8<|b|7*7wZvMArYnp0c
z=Zkw`uWx?lwJwRv*_RXPDPxf&RP(j!v+obLoZoMEf0v(RvA1jKr^n0B2TE*w+p8Zh
zypu!PZL@5z;O#u~<+ZsQj+|ZrO_MAdg{CZEQ3dma!~>e(yhlu4aGqz31E<#(m+vQh
zgQn`#{{HtkU4=hQHT2}C^=se0U3*{9X5aJ()n5CcllSX298VTVSUApzYu>=Y{xFOe
zVsewvlq0NgdzvQgXn@-jK)}`yi&E_O_}%8$kL5qG`X{^QLuS6XA7|VJ?AU}`{Mi`6
zAqpbC%(S1umv?5y%`Fp8ckfl#+LSVFSK{^+VV_x@JF>NV<=4-8cC<@cN2Gc!kAkVW
zhiBv)3zaBawOKRmL%rv&EAeyEO#76_eJ??xFm~z3$F0Vuk;~=R@C8k>D!QV>9eeY$
z>*X`-Q)JdlwzhH~+A`sp$qP*}F|E5B^d;P4!ZZKuPYn9I+<(b`JLA?F!N1pUQt#QZ?$VEsXLh=7UNi4Zf@*QmK7sw3GrxToN_XfDniTFn
zFYcs8VeC@QN9jk8t~z+p>&SiA<;5C%m)u`-`{$mc4?fl^C$bmDF7mi^mSxl*x1kgCy|wbf$2zqPl)UP
z|NkHSe{kUcfrkGL4F4Ja-=1J)HR1OE|Npn8F)%PNSWSQl+@3ID8%We@!UQXZv~B+x
z(zaQpZQGWX1{P(ovPw&{Vn}0P*p>#;pT>|j!79y)!77cx%8DV)ih*H*l@$X6NYU;8
zx3~S@#=wyF`}gmI2M=Dnc=7AkuV>Dj5lRpdd?+q>Rg3PfT6lNWg1f8c-(5BD?y9+WSIxP*
zYWCe#v+k~%xxT&9!N|`{YeJaQb$i1{em0M6ZL2*zlK%hu_wVoDe}De`{r&szuU~(E
z{`~Xf$Di-te}DV-`|H==U%veM{Q1|XPd`6?{Q2R-&-d?tynXxq&71G9Uw?n~>f6hg
z-(I}<`uzFVXV1Pqefs6elh2PHeSYxZ)4h8i@811*=g!C5w?Evv_2K5t_cw05zjp22
z)vNEWTzPx>^4m+7-dw!+=E8+tix-D@X7Tf+S?k@k)_oG}{?@{xL{LyfQe2L+RFRh_
zRYQ5Mrt*Z#moHyF_^2pip0JQaU|^|^TBwkK#QF2*`|^(NS#$aR{YPuotZOe_wt3ds
z$B&;a?LW0^!PVNFnKPT$OG(Mb#@0tgRaV3<+qP|oxVV&!Nsg0cmb|>uf(0K|t@_{F
z_$I>TqyWF@-MbH@rRDqkALb?8smXpkckY|GxcYd{n^CUUt&KC93m4d$=EQm5h>otF
zJL9{vWzOXKl`hr=Jq>So3sM*v7+9S=T^vIyZoR$xz5Ysy%z=+rqSlq~6~6sy?&3u}
z>{{;{Lj$%jbur(m&d*-UExusd$_^$zfdWOpJ39noLK(m7=$&ij{;OUy&%3D7NUw5|
zO=ax-_n-g%nIOLNx7w3?XJ7b-`yMvnK|*WFO)8$pmQBq)f70y9WPkhH_4+%%&B<}z
z|8v{&=g$xGP0BpadHvhz`$v;L&gac;+5Yf;(#QSt_TO6dms5Gdmosz6Cd*zwcC!{CaeHe68-|x1seRdiCa<
zli&5*P5Y#{W_r)bSEg70#q2%jk~hi4M@8N9kW1Ml7M~^Rg854Jodv=SDvNv-CUBTB
zIx1abVe1SKR!~v$T`+;egwa{)91CBkfv|(hA|Hi`97c?;O2=5lIt7FiRFr%cOyn?N
zbQikMBIlVS+@MnEt1#(^38Sabc@{NK9pMEkg+2==9Wh|^7P`x#=b0jWKqb&uVX}(}
zqp#3e7Bf#3;Rh;#J_{zh7%=(^-D9!y%n)YvI5ca8gU}@x&PfGoSrb}}0$WsiI<-_3
zeWoZrG!JZVx$UAT6em2@!@_rp(nI6G?v~RohC*_}S3N9zrYLio1@^04aB-ZZAS~+1
z-0G<{bA?aPL6=OSeBrI0HohY2AB_U%
z9y#n%DYTt)(hi>qM^c+qW?g3S%rFyH(L6d!p;IooNyTj%=cE}^eJ3oLli8#a*2X!>
z;H8?!Avd30_y0dQoF(tJMd;UTrqlOhHhx;W{r<{t%eya4xLbBV`8>ivcBB*h>eY%tnNS4sPxsAmzUGe?D*R^)A;=y)7R^Er=Oo^
zoc_-C`@Qo2dw%lkL~JN{xX6{??#l<|e!aS!laKvveqOnJUZ?ik&gbzJAD2#l`uoz?
zZHJ?y-TP!re{rn#_KM9ak$hRS_uIE`+8MI4vf?Wi2G+x`|#kWI8gDxP3CdyC2Q8=IgzT(JKc))<*t7HsFbOe
zpX2uL`r5Kn*|poVSH7OFFUztyYQFCKgLWE8HW|u&AAk91nQw57zvO>p-KB#~;+}WK
zqLE-0W0>OSRQ2!W^T?l~yO!7;iEB;p>mDcXgUyoiqFSTjj{ls?Qg6d|c4`s5iWh2I2qjy0Qgnah1yE!F0@GEKQJtKxa~B6*MZE6bAmvMQfvFP8Us
h&v{-5R;KOwE&u1Sd{okUF*8ur@9FC2vd$@?2>{-#WSsy2
literal 0
HcmV?d00001
diff --git a/upstream/clipper-6.4.2/Documentation/Images/clipper_rounding.png b/upstream/clipper-6.4.2/Documentation/Images/clipper_rounding.png
new file mode 100644
index 0000000000000000000000000000000000000000..3134f7786d4ad3f6dc994339e442711699ed83a9
GIT binary patch
literal 10568
zcmeAS@N?(olHy`uVBq!ia0y~yV0^*Az?jRy#K6Gd?4M`Az`&qW;u=xnT$Gwvl9`{U
z5R#dj$`G7bqF`j9;8;+kU}Ruuq+n=bWnyS$WTc>NXkcK#yU9GAfq{XM9T6{Vp?~
zxRC1mNjonyFfecyctjR6Fz_7)VaDV6D^eI37+BIBeH|GXHuiJ>Nn~YU(3tP(;uunK
z>+N0c0GaP|)jzy%aBymH6cSQUnbIh^;R5sC)aE@CCvPrSy=nN`<<#MGS}X5%+&bla
zYpvI&Q0efZ*H@P26_=|%ePm%#UR@X(baRsM`gbiYIcrmIimef0RZ(FP>v44ApTNR&
z|w#DfMqIy-pU4*I&J81UpNDK#e+2n$N`G|%ohksxu$#f6QYN{hGr{U$5B
zqb~OKea4CJ&Prx5>MTBKww669?(pFqC7kzv_Fa4Y;iAQky(?p*yO(-z{bwrha(2b{
z!~d`U%6}bfANu77W4g^_>s4%Q7j9Yo`}jiRS;m}MLT}q2_`dy9vzFa)N&fR&>%RTJ
zyNBPlT&DiV@utS3{{L?>Do*{l)@r--^>v=tr}x|Uy}i9LrSlr|tOd0N!WY-vdUyB0
z9*c;A>h%@3E0@pwxYp=>=r{HG3)b@b+cf_DJ#o^auMKLKkDfjG?fx_|@#rQ0-r)}mYg
z|M+!3V%fYuHSb)OEocA#QU1pVXAzMH^8Xmm+ZY#TS@TVuCRb$h=Z4X;8l{7)PA$)w
zaprgG{`F@zedZ|oBvzqrSBI>^^cs%>*<#QVE
zXKw%e{onjkZ+%iK#LD|qGnM?VT}!y#y?1x~o4ajyx6aj^cH8^^m(xwT_pP=(Pyhea
z^0fK>H`YIY-r=0Av1qgKazD>