Skip to main content

Decompose 2D polygons into convex pieces.

Project description

Installation

$ pip install poly_decomp

Usage

import poly_decomp as pd

polygon = [[0, 0], [5, 0], [5, 5], [2.5, 2.5], [0, 5]]
#           |\    /|
#           | \  / |
#           |  \/  |
#           |      |
#           |------|

print pd.polygonDecomp(polygon)
# --> [[[0, 0], [2.5, 2.5], [0, 5]], [[0, 0], [5, 0], [5, 5], [2.5, 2.5]]]
#           |\   /|
#           | \ / |
#           |  /  |
#           | /   |
#           |/----|

print pd.polygonQuickDecomp(polygon)
# --> [[[5, 0], [5, 5], [2.5, 2.5]], [[2.5, 2.5], [0, 5], [0, 0], [5, 0]]]
#           |\   /|
#           | \ / |
#           |  \  |
#           |   \ |
#           |----\|

About

Implementation based on Schteppe’s poly-decomp.js.

Algorithms based on Mark Bayazit’s Poly Decomp.

Release History

dev

0.0.1 (2016-10-25)

  • Initial release.

Project details


Release history Release notifications

This version
History Node

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
poly_decomp-0.0.1-py2-none-any.whl (12.7 kB) Copy SHA256 hash SHA256 Wheel py2 Oct 25, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page