Convex Partitioning

I guess this question is mostly directed towards Erin, or anyone else who has a good idea of the internal workings of Box2D.

Would it be beneficial (i.e. faster) for Box2D to deal with polygons made entirely of triangle shapes (a la Eric's ear-cutting algorithm), or an optimal convex partitioning? I'm studying computational geometry in school now, so I might end up writing something like this. Would make for a good final project I think, or least part of one.
Optimal convex partitioning would give the best performance. Box2D might be optimized better for triangles, but an n-sided polygon should be faster than n-2 triangles when n is larger than 3 or so.
There's the other factor that with more shapes, not all of them will make it past the broadphase.
So, I'm just about ready to start this project now. I was planning on using Steiner points, but the method described in
Bernard Chazelle and David P. Dobkin. Optimal Convex Decompositions.
Computational Geometry, G.T. Toussaint (Editor), pages 63-133, 1985.

Looks stupid complicated. I guess no one here has attempted it, or even read it?

Perhaps I'll attempt this Mark Keil's method which doesn't use Steiner points instead. I'll let you know how it goes... I'll be done in less than a month if everything goes according to plan.
I don't know what the deal is with that Chazelle guy, his triangulation algo is also legendarily complicated.. it's like he got off on saying "so here's a solution that's excellent in theory, have fun trying to implement it!"
Many of Chazelle's algorithms have never been implemented.
At one point when I was looking into this stuff I found an applet online that calculated the optimal decomposition, I was going to suggest you look into that and see if you could convince the author to share the code, but alas, I can't find it now. I also decided that implementing the "fastest" (asymptotically, at least) algorithm for this stuff was likely out of the question due to the complexity - it's all well and good to prove that a problem can be put through a series of nasty transformations so that it ends up in a form that we can solve quickly, it's something else entirely to implement each of the transformations along the way (many of which are only proven to be "fast" by invoking other chains of seriously nasty problem transformations).

If you're willing to settle for likely optimal decompositions instead of provably optimal ones, I'm pretty sure there are probabilistic algorithms that are far simpler and still relatively fast - is that an option, or is this more an "I'll do it and I'll do it right, dammit!" situation?
ewjordan wrote:
If you're willing to settle for likely optimal decompositions instead of provably optimal ones, I'm pretty sure there are probabilistic algorithms that are far simpler and still relatively fast - is that an option, or is this more an "I'll do it and I'll do it right, dammit!" situation?


Haha, typically that's the motto I live by, but due to time constraints I'll settle for anything. This is the paper I'm thinking about implementing, but I haven't settled on anything yet. If you know of anything better/easier, do let me know 🙂
So... the other algorithms looked difficult, so I made up my own. It seems to be near-optimal (with steiner points), and runs in O(nr) time. It's not quite complete, but it looks pretty promising.
It might actually be O(n log n)... I have to think about it a bit more :p

Anyway...check this. Inserts points in the middle too, if necessary 😀 So simple, so beautiful, so quick... how has no one thought of this?

Original thread: https://box2d.org/forum/viewtopic.php?t=2057