Sharing: code to create a physics outline for any image object

A limitation of the physics engine is that if you have an odd shaped image, it can be difficult to create a similarly shaped physics object,.

Some time back, I posted code that would automatically create a set of vectors around the outline of an image, so you can create a physics object that has the exact shape of that image. That code had a couple of issues, so I rewrote it, and now it is here

https://gist.github.com/dermotbalson/5532485

This code includes demos with about 10 built in Codea sprites, bouncing them around the walls. I’ve deliberately chosen the complex sprites, and it seems to handle all of them. It is very easy to use - you simply provide an image to the function and it returns a set of vectors you can feed into a physics object.