[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] poly draw



Shandy Brown wrote:
is there a survey of polygon filling algorithms somewhere?  I can think
of a faster one than scanline filling off the top of my head.  Assuming
scanline filling is what I assume it to be.
dunno if there is a good survey. the scanline pygame uses computes the "start and end" pixel for each scanline and does a very fast fill. of course it's got to check out all the segments because there could be multiple spans on each scanline. i'm sure it could be optimized by sorting the line segments and such, but i haven't seen anyone drawing huge multi-edge polygons with it so far either. for drawing triangles and squares the sort wouldn't help.

it's been a long time since i looked at the line drawing. it could perhaps be optimized by breaking each line segment into a more detailed structure. with info like miny,maxy and slope. this would speed up the endpoint computation, but i'm certain we are heavily bottlenecked at the "fill".