Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Polygon decomposition example — Gideros Forum

Polygon decomposition example

ndossndoss Guru
edited February 2012 in Relax cafe
I converted Mark Bayazit's polygon decomposition algorithm (http://mnbayazit.com/406/bayazit) to lua and made a quick demo video. It's still got some more work to go (e.g., code is a mess, hangs sometimes, doesn't split polygon's with more than 8 vertices into smaller ones). There are three basic functions in the code:

1. convert the vertices to counter-clockwise
2. simplify the shape (i.e., remove co-linear points and points that are close together)
3. convert the shape to a series of convex polygons

The idea is to be able to convert a hand drawn shape into a box2d set of convex polygons. I'll share the code once it's a little more polished.


+1 -1 (+3 / -0 )Share on Facebook

Comments

Sign In or Register to comment.