-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concave polygons not supported: what are pros/cons of for this? #7
Comments
I just remembered that I wrote about this on my blog back in 2009. Nevermind the formatting on the blog, it looks a lot different now than back then. |
@Genbox Thanks for chiming in on this! I've seen a lot of references to Open Source software that breaks apart concave shapes into collections of convex ones. Conceptually speaking I'm attracted to using non-friend non-member functions to compute the set of convex-sets and then implement those basically using collections of the existing Box2D Shape objects. A benefit to having something like a I've ripped out most of original Box2D distance and manifold code and left behind only code that deals with Anyways, that's just some of my thoughts on this. |
That is the solution I went with. I implemented a couple of different polygon decomposition algorithms (Seidel, Earclip etc.) and made them accessible in a "factory". The factory is just a simple API for creating polygons of all shapes and sizes. Should the user decide to give a concave polygon, I decompose it into multiple convex polygon shapes and attach them with fixtures. It is not pretty but it seems to work fine. I've also implemented a few simplification algorithms to make sure that user input polygons have as few points as possible before doing the decomposition to make a better result. |
This issue was moved to louis-langholtz/PlayRho#11 |
Is it worth supporting concave shapes? Can all concave shapes already be supported via multiple fixtures having convex polygons? Is there a more efficient way to do concave shapes?
I believe that at least part of the problem of supporting concave polygons is supporting inside corners. This seems to have some implementation already in chain/edge shapes.
If nothing else, is there an algorithm for constructing any concave polygon out of convex polygons? Can this be conveyed more easily to users?
The text was updated successfully, but these errors were encountered: