Nov
18
Detecting Edge Pixels with Marching Squares Algorithm
Posted by | Posted in Actionscript 3.0, Algorithms | Posted on 18-11-2009
This is a great experiment from Sakri.net. The applications for this should be amazing. It's incredibly simple to use as well. Say you have an object on the stage named test, you simply do the following:
import flash.display.BitmapData; import net.sakri.flash.bitmap.MarchingSquares; var bmd:BitmapData = new BitmapData(test.width, test.height, true, 0x00000000); bmd.draw(test); var temp:Array = MarchingSquares.getBlobOutlinePointsClockwise(bmd);
Now temp contains Point objects that describe the outline of your item!
