npm 中文文档 npm 中文文档
指南
npmjs.com (opens new window)
指南
npmjs.com (opens new window)
  • 快速入门

    • npm 是什么?
    • npm 安装和更新
    • npm 防止权限错误
    • npm package.json 文件
    • npm 安装包
    • npm 更新包
    • npm 卸载包
    • npm 创建 Node.js 模块
    • npm 发布和更新包
    • npm 使用语义化版本
    • npm 使用 Dist-tags 标记包
    • npm 包和模块的了解
  • 命令行
  • 配置 npm

Clipper2


A Polygon Clipping and Offsetting library (in C++, C# & Delphi)


GitHub Actions C++ status C#

The Clipper2library performs intersection, union, differenceand XORboolean operations on both simple and complex polygons. It also performs polygon offsetting. This is a major update of my original Clipper library that was written over 10 years ago. That library I'm now calling Clipper1and while it still works very well, Clipper2 is better in just about every way.

Compilers


C++: Requires C++17 (but could be modified to C++11 with only minor changes)C#: The core library uses Standard Library 2.0 but the sample code uses .NET6Delphi: Compiles with any version of Delphi back to Delphi 7.

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);

Ports to other languages


Java: https://github.com/micycle1/Clipper2-java/ Kotlin: https://github.com/Monkey-Maestro/clipper2-kotlin
Last Updated: 2023-06-12 08:44:55