Skip to main content

Decompose 2D polygons into convex pieces.

Project description

https://img.shields.io/pypi/v/poly_decomp.svg

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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

poly_decomp-0.0.1-py2-none-any.whl (12.7 kB view details)

Uploaded Python 2

File details

Details for the file poly_decomp-0.0.1-py2-none-any.whl.

File metadata

File hashes

Hashes for poly_decomp-0.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 9f7d86708d76ef2ee7fd8673f717f64be2657bf1b953246fad320cb70932a77e
MD5 e24a196247311763b73c7b55e58ec5b4
BLAKE2b-256 2607e13b055b2b3dbf01010737ee1c80ab047b1aabccb17124107cd05c326b4e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page