Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Polygon Clipping and Offsetting - C++, C# and Delphi

License

NotificationsYou must be signed in to change notification settings

AngusJohnson/Clipper2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A PolygonClipping andOffsetting library (in C++, C# & Delphi)

GitHub Actions C++ status C# LicenseNugetdocumentation

TheClipper2 library performsintersection,union,difference andXOR boolean operations on both simple and complex polygons. It also performs polygon offsetting. This is a major update of my originalClipper library that was written over 10 years ago. That library I'm now callingClipper1, and while it still works very well, Clipper2 isbetter in just about every way.

Compilers

Clipper2 can be compiled using either C++, or C#, or Delphi Pascal. The library can also be accessed from other programming languages by dynamically linking to exported functions in theC++ compiled Clipper2 library. (Since the C++ compiled code ismeasurably faster, C# and Delphi developers may also prefer this approach in applications where the library's performance is critical.)

Lang.Requirements
C++:Requires C++17 (could be modified to C++11 with relatively minor changes),or
C#:The library uses Standard Library 2.0 but the sample code uses .NET6,or
Delphi:Compiles with any version of Delphi from version 7 to current.

Documentation

Extensive HTML documentation

Examples

      //C++      Paths64 subject, clip, solution;      subject.push_back(MakePath({100, 50, 10, 79, 65, 2, 65, 98, 10, 21}));      clip.push_back(MakePath({98, 63, 4, 68, 77, 8, 52, 100, 19, 12}));      solution = Intersect(subject, clip, FillRule::NonZero);
      //C#      Paths64 subj = new Paths64();      Paths64 clip = new Paths64();      subj.Add(Clipper.MakePath(new int[] { 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 }));      clip.Add(Clipper.MakePath(new int[] { 98, 63, 4, 68, 77, 8, 52, 100, 19, 12 }));      Paths64 solution = Clipper.Intersect(subj, clip, FillRule.NonZero);
      //Delphi      var         subject, clip, solution: TPaths64;      begin        SetLength(subject, 1);        subject[0] := MakePath([100, 50, 10, 79, 65, 2, 65, 98, 10, 21]);        SetLength(clip, 1);        clip[0] := MakePath([98, 63, 4, 68, 77, 8, 52, 100, 19, 12]);        solution := Intersect( subject, clip, frNonZero);

clipperB


Ports to other languages

lang.link
WASMhttps://github.com/ErikSom/Clipper2-WASM/
Javahttps://github.com/micycle1/Clipper2-java/
Kotlinhttps://github.com/Monkey-Maestro/clipper2-kotlin
golanghttps://github.com/epit3d/goclipper2

[8]ページ先頭

©2009-2025 Movatter.jp