Re: Draw & fill regular polygon?

Fabian Giesen <[email protected]> Thu, 11 Aug 2011 00:54:46 -0700
Newsgroups gmane.games.devel.algorithms
Message-ID <[email protected]>
On 10.08.2011 23:05, Martin Gladnishki wrote:
> There are also a number of line rasterizing algorithms that do 2, even 3
> pixels per iteration, i.e. with them you will be able to fill the arrays
> faster. Lookup for double-step rasterizing algorithms.
>
> Also, in my experience the extrema arrays are not needed: for convex
> polygons there are only two active edges at a time, therefore you just
> need to traverse the poly in clockwise and anti-clockwise order to
> switch the active edges until they meet at the maximum Y coordinate.

Even for general polygons, the auxiliary arrays aren't necessary; you 
keep a linked list of active edges sorted by their current x coordinate 
(in the last processed scanline). This is fairly simple to code (and 
keep up to date).

 From there, you just need to count the current winding based on the 
orientation of active edges. That allows you to implement all popular 
fill rules.

-Fabian

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list