skip to navigation
skip to content

poly_decomp 0.0.1

Decompose 2D polygons into convex pieces.

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.
 
File Type Py Version Uploaded on Size
poly_decomp-0.0.1-py2-none-any.whl (md5) Python Wheel py2 2016-10-25 12KB