Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an efficient standard algorithm to raster a polygon including its inner area [duplicate]

Possible Duplicate:
Rasterizing a 2D polygon

I need to raster a polygon including its inner area (determine all tiles of a grid that lie inside the polygon). Currently I determine the boundary tiles by using a simple Bresenham but I have no efficient way up to now to raster the "inside" of the polygon (which might be concave as well). My approach so far is to limit the tile range to the rectangle including the polygon an then determine for every tile center whether it lies inside or outside using the polygon winding algorithm. This is quit inefficient since it involves checking every polygon boundary segment for every tile. From a first view there should definitely be a faster approach e.g. sth. like winding using the rastered boundary. Is there a standard algorithm which tackles this problem and perhaps even a library implementation in C++ ?

like image 227
Martin Avatar asked Dec 12 '12 10:12

Martin


1 Answers

There are quite a few resources on the net, for example:

  • Efficient Polygon Fill Algorithm With C Code Sample;
like image 164
NPE Avatar answered Sep 19 '22 04:09

NPE