Edge tracing / b2ChainShape creation for tile based games

Had a thought the other day that I should share some code I wrote for tracing the edges of solid tiles in a tile-grid based game prototype I made - I did a cursory search online and didn't find anything like it before I started. The algorithm is straightforward enough but there are a fair number of steps.

It basically breaks an arbitrary-sized tile world into "chunks" (e.g. 10x10 tiles), and within each chunk traces the edges between solid & empty, joins them to create as few vertices & discontinuities as possible, and creates b2ChainShape's to accomodate. Here's a visual example from the game prototype I used it on (SubMiner):

Image

If anyone would find this useful let me know, and I'll separate out the code and post it. The code is prettier than the placeholder graphics :). It's C++, using a bit of the STL (mainly vector<> I think). The one addition I didn't get time for was, between 10x10 chunks, to create "ghost vertices" in adjoining chain segments (the prototype I was working on didn't need it).
Nice!
People using Tiled might like to have that too, not sure if there are forums for it?
Awesome. This will be extremely useful for us. Will you be willing to share the code or the algorithm you are using?

Regards
Awesome, congrats!
I was searching something like that. Do you plan publish the source code? Would be helpful for may developers!
Any progress on a source code release?
At the end I used this approach:

http://www.learn-cocos2d.com/2013/06/ge ... s-cocos2d/

You can find the full project in this tutorial.

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