From f7b4cc602b9a646fbc66f3f17d6bb9c20efc3ead Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 24 Jan 2021 18:44:56 +0100 Subject: Initial commit --- .../Documentation/Docs/Overview/Changes.htm | 1269 ++++++++++++++++++++ .../Documentation/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 ++ 7 files changed, 1928 insertions(+) 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 (limited to 'upstream/clipper-6.4.2/Documentation/Docs/Overview') 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

+ + + + + + +

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

+ + + + + + \ 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. +

+ + + + + + + + \ 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);
+  }
+        
+ +
+ +
 
+ + + + + + + + + + \ 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

+ + + + + + + \ 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.

+ + + + + + + + + \ 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

+ + + + + + \ 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: +


+ + +

Current Version: 6.2.1

Author & copyright:
Angus Johnson. Copyright © 2010-2014
License, terms and conditions: Boost Software License

+ + +

Terminology:
+


+ + +

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

+ + + + + + + \ No newline at end of file -- cgit