/shapeops-py

Boolean operations and overlap removal for curves

Primary LanguagePythonApache License 2.0Apache-2.0

shapeops-py

A Python port of the caryll-shapeops Javascript library to perform boolean operations and overlap removal on Bezier curves.

The shapeops.ufo module provides the same interface as the BooleanOperations package, with the four union, intersections, difference and xor operations, and support for the PointPen protocol.

Usage

TODO

import shapeops
shape1 = [[
  {'x': 0, 'y': 0, 'on': True},
  {'x': 100, 'y': 0, 'on': False},
  {'x': 200, 'y': 100, 'on': False},
  {'x': 200, 'y': 200, 'on': True},
  {'x': 0, 'y': 0, 'on': True}
], ...]
shape2 = [...]
result = shapeops.boole(shapeops.ops.intersection, shape1, shape2)

Credits

  • Belleve Invis (@be5invis), the author of the original Javascript library.
  • Mike Kamermans (@pomax), and his Bezier.js library (the shapeops.bezier package is a Python port of the latter).
  • Frederik Berlaen (@typemytype), the author of BooleanOperations.
  • Gregor Ratajc (@greginvm), maintainer of the Pyclipper bindings for Angus Johnson's Clipper library, which is used by shapeops to perform boolean operations on polygons.