Question

I'm wondering if there's an algorithm that would can get pixels inside a certain "pixeled" area?

So if we have a 3 x 3 pixel square that isn't filled in, the plots that aren't filled in would be: 2,2 the grid being:

1,1 2,1 3,1
1,2 2,2 3,2
1,3 2,3 3,3

thanks!

Was it helpful?

Solution

Sounds like you're looking for something akin to the filled polygon scan conversion algorithms used in computer graphics. The exact algorithm you choose will depend on a combination of how fast you need it to run and what kinds of shapes you want to support (convex are the easiest, concave is harder, shapes with holes are harder too). There is lots of good reading material out there on this, here is one with some nice diagrams:

http://www.csee.umbc.edu/~rheingan/435/pages/res/gen-4.Scan-single-page-0.html

Google "Filled Polygon Scan Conversion" for lots more info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top