this uses a scanline-esque algorithm--we render a single row of pixels at at time.
this uses a scanline-esque algorithm--we render a single row of pixels at at time. to do this, we calculate the various X intercepts of each of our line segments, and write between X intercepts. there are two special cases that have to be handled: spikes and hinges.
a spike looks like either: /\ or \/... it is a local Y-minima (or Y-maxima). these are important because unlike other X coordinates they do not indicate the start (or end) of a "filled region". only the pixel itself should be filled.
a hinge is a joint between two line segments whose slopes have the same sign (e.g. they are both falling or rising). in this case, we only want one of their X coordinates, not the other.
a polygon is a set of lines. it is assumed that each line's p2 is equal to the next line's p1 (with the final line's p2 equal to the first line's p1). the user is required to provide lines in this order.