$ pip install poly_decomp
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]]]
# |\ /|
# | \ / |
# | \ |
# | \ |
# |----\|
Implementation based on Schteppe's poly-decomp.js.
Algorithms based on Mark Bayazit's Poly Decomp.