Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python binding for Clipper

Is there some Python binding for Clipper library?
I need OffsetPolygons function. I've tried to convert C++ Clipper code to Python, and I managed to do that up to some point, but then it becomes too complex - and it seems that I should convert to Python complete Clipper file - which is huge job.

Some simple code for polygon borders offsetting with Python is available here, but it doesn't solve the problem universally - when offset distances are high and some corners disappear or new ones appear.

Any suggestions to other Python based solutions for polygon offsetting are very welcome.

like image 949
Marija Velickovic Avatar asked Sep 02 '26 00:09

Marija Velickovic


1 Answers

You can try pyclipper (source) - it is a wrapper around the C++ version of the Clipper library (v6.2.1). It exposes all of Clippers' public methods. Installation via pip:

pip install pyclipper
like image 168
greginvm Avatar answered Sep 04 '26 12:09

greginvm