← Back

ofxClipper2

github.com/ofxyz/ofxClipper2 · @ofxyz
OF 0.12 Geometry Algorithms

V2 of the famous Clipper lib of Angus Johnson

0 0 Last commit 3mo ago Created 4mo ago

README

ofxClipper2



preview

An openFrameworks addon wrapping Clipper2, a library for polygon clipping, offsetting, and triangulation.

Installation



Clone this addon into your addons folder with submodules:

git clone --recursive https://github.com/YOUR_USER/ofxClipper2.git


If you already cloned without submodules:

cd ofxClipper2
git submodule update --init --recursive


Requirements



Usage



Include the wrapper header to get both Clipper2 and openFrameworks conversion helpers:

#include "ofxClipper2.h"

using namespace ofxClipper2;

PathsD subject, clip;
subject.push_back(MakePathD({ 100, 100, 200, 100, 200, 200, 100, 200 }));
clip.push_back(MakePathD({ 150, 50, 250, 150, 150, 250, 50, 150 }));

PathsD result = booleanOp(ClipBooleanOp::Intersection, subject, clip);
drawPathsD(result);


You can also use the Clipper2 API directly via Clipper2Lib types and functions.

License



Get this addon

HTTPS
SSH