clipper2-dart
A Polygon Clipping and Offsetting library in Dart
This is a Dart (Flutter) port of Angus Johnson's excellent Clipper2 library originally available for C++, C# and Delphi. The port uses the C# code as reference.
The library compiles on all platforms (mobile, desktop and web). When compiling for the web, the precision is restricted, as there are no 64-bit integers available.
The Clipper2 library performs intersection, union, difference and XOR boolean operations on both simple and complex polygons. It also performs polygon offsetting. This is a major update of the original Clipper library that was written over 10 years ago. That library now called Clipper1, and while it still works very well, Clipper2 is better in just about every way.
Documentation
The original GitHub repository
Extensive HTML documentation
Examples
The example
subdirectory contains a Flutter app that demonstrates the functions of the library.
import 'package:clipper2/clipper2.dart'; final subject = Path64Ext.from([100, 50, 10, 79, 65, 2, 65, 98, 10, 21]); final clip = Path64Ext.from[98, 63, 4, 68, 77, 8, 52, 100, 19, 12]); solution = Clipper.intersect( subject: subject, clip: clip, fillRule: FillRule.nonZero, );