Re: Draw & fill regular polygon?
Martin Gladnishki <[email protected]> Thu, 11 Aug 2011 09:05:27 +0300
| Newsgroups | gmane.games.devel.algorithms |
|---|---|
| Message-ID | <CAGWOt2-DSKyR+e8oo-20ikHbGq9hp3k4_deoBpx-LB74rCHcGw@mail.gmail.com> |
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. Hope that helps further. Cheers, Martin On Wed, Aug 10, 2011 at 6:29 PM, Graham Rhodes ARA/SED <[email protected]>wrote: > Some helpful Google search terms are "polygon rasterization" and "polygon > scan conversion." Someone else mentioned the Foley/van Dam book/et al. book, > which is a good reference that describes the classic algorithm. The book > Graphics Gems I also has a discussion, though it is brief. You can also find > this stuff online, for free. For example, two sets of lecture slides from > University of Virginia that look good: > > > http://www.cs.virginia.edu/~gfx/courses/2004/Intro.Fall.04/handouts/11-polyscan.pdf > www.cs.virginia.edu/~asb/teaching/cs445-fall06/slides/09-rasterization.ppt<http://www.cs.virginia.edu/%7Easb/teaching/cs445-fall06/slides/09-rasterization.ppt> > > I even found this YouTube video: > > http://www.youtube.com/watch?v=TNbkX5bYrtE > > Graham > > -----Original Message----- > From: Joel B [mailto:[email protected]] > Sent: Wednesday, August 10, 2011 7:49 AM > To: Game Development Algorithms > Subject: [Algorithms] Draw & fill regular polygon? > > I should know how to do this, but i don't. I only have the ability in my > system to draw lines (x1,y1,x2,y2)' to a bitmap, or write to the bitmap as a > byte array. Can someone tell me the stepwise procedure to draw a polygon of > n sides and then fill it? Having trouble finding anything online that > doesn't use pre-existing primitives or libraries. > > Thanks, > > Joel > Sent from my iPhone > > ------------------------------------------------------------------------------ > uberSVN's rich system and user administration capabilities and model > configuration take the hassle out of deploying and managing Subversion and > the tools developers use with it. Learn more about uberSVN and get a free > download at: 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 > > > ------------------------------------------------------------------------------ > uberSVN's rich system and user administration capabilities and model > configuration take the hassle out of deploying and managing Subversion and > the tools developers use with it. Learn more about uberSVN and get a free > download at: 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 > ------------------------------------------------------------------------------ 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