Generate Convex Hull from Points List
I was messing around with some physics and collision on sprites and I found that not only is using Per-Pixel collision detection expensive but it is also very hard to get accurate physics. After spending some time researching different types of 2D collision I found that 2D convex hull collision gave some of the best results and so I set to work on figuring out a way to get the best of both worlds; and that is where this Convex Hull Generator comes into play.
While reading through my Real Time Collision Detection book I found a reference to Andrew's Algorithm for generating convex hulls. After doing some quick searches through Google I found a great reference site and sample app here.
I spent some time converting the Java source code included in the sample app over to C#; the C# code works great for creating a point list from the pixels of an object and creating a Convex Hull from that information. I have included a download link to the source code and an easy to use Win Forms demo project below.
|
Download Source: Convex Hull Generator
- shawn's blog
- Login or register to post comments
