More Marching Squares

June 30th, 2010| Posted by slembcke
Categories: Uncategorized | Tags:

Polygon detection
After a little more filtering of the data, I’ve been able to get nearly perfect detection of sharp polygonal edges in an image! The following image has 28 regular nonagons in it and the output is exactly 28 loops of 9 vertexes each (the green outlines) that are nearly perfect nonagons. The original line segment set was 6,884 segments, and this reduced with near pixel perfect results down to 252 segments. This should allow the algorithm to work very well for creating convex polygons for loaded or dynamically created sprites without creating any extra vertexes that slow down the collision detection.

Comments are closed.