Giter VIP home page Giter VIP logo

clipper2's Introduction

Clipper2

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

GitHub Actions C++ status C# License Nuget documentation

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 my original Clipper library that was written over 10 years ago. That library I'm now calling Clipper1, and while it still works very well, Clipper2 is better 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 the C++ compiled Clipper2 library. (Since the C++ compiled code is measurably 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
WASM https://github.com/ErikSom/Clipper2-WASM/
Java https://github.com/micycle1/Clipper2-java/
Kotlin https://github.com/Monkey-Maestro/clipper2-kotlin
golang https://github.com/epit3d/goclipper2

clipper2's People

Contributors

angusjohnson avatar reunanen avatar philstopford avatar damiandixon avatar sergey-239 avatar sethhillbrand avatar djgosnell avatar mmassing avatar cwangbh avatar sebastiandirks avatar lederernc avatar lutz avatar mattdev avatar jspam avatar guuskuiper avatar elara-leitstellentechnik avatar balagansky avatar aismann avatar zeronsix avatar bubnikv avatar loumalouomega avatar freza-tm avatar phytolizer avatar klauslh avatar jschuh avatar jmalinza avatar jamesruan avatar thehans avatar gornhoth avatar geoffder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.