Simonson, Lucanus J wrote:
"I've never seen a comparison with clipper before, I've never
heard of clipper and would like to learn more. Can you provide a
link or reference? I found a sourceforge site with minimal
description of clipper, but it
left me with a lot of unanswered questions."
Hi Luke.
I'm the author of
Clipper and am happy to answer your questions as best I can, but
perhaps I can preempt some of them with a little background
about Clipper and myself.
Firstly, I've only
recently created the Clipper library (ie within the last 3-4
months) and that may explain why you haven't heard of it. I
originally wrote it in Delphi Pascal, but I've translated it
into C++ too, and has been released with a Boost license. I
wrote Clipper because I wanted a polygon clipping library (in
Delphi) that wasn't encumbered with restrictive licensing. I'm
still refining the library and have several updates in the
pipeline (including polyline-polygon and polybezier-polygon clipping).
Clipper is based on the Vatti clipping algorithm which places no restrictions on
the types of input (subject and clipping) polygons. However,
Vatti's original paper completely omits any discussion of 1. how to
handle what I call 'complex' intersections - intersections
involving more than 2 edges; and 2. how to handle overlapping
horizontal edges. My Clipper library extends the Vatti algorithm
by addressing both these issues. Clipper also extends the Vatti
algorithm by implementing the NonZero polygon filling rule for
input polygons (as well as Vatti's EvenOdd filling). I'm aware
of one limitation of my Clipper library: because it uses
floating point math it isn't 'robust' in the strict sense.
However, errors (which are extremely rare) are properly trapped
and reported as a failed clipping operation.
In my testing ( see http://www.angusj.com/delphi/clipper.php#features
), Clipper has a number of advantages over GPC, a well known
clipping library that's also based on Vatti's algorithm. Clipper
- 1. is significantly faster; 2. properly handles complex
intersections; 3. accepts both EvenOdd and NonZero filling input
polygons; 4. doesn't require payment for commercial use.
The SourceForge site for Clipper is: http://sourceforge.net/projects/polyclipping/
About myself: I've been writing computer code for 30yrs as a
hobby. (I was a medical practitioner before I retired 15 yrs ago
due to illness.) For the last 15 years I've been
using Delphi (Object Pascal) and until now have never used C++. The
C++ translation of my Delphi Clipper library is the first code I've
written in C++ and should explain any unorthodoxy in my C++ coding
style. (I'm aware that the C++ code is currently about 15% slower
that the Delphi code so I suspect I'm not making the most of this
language.) I'm very happy to receive constructive feedback and hope
I can answer any questions too.
Angus