title: Scanline Fill Algorithm in Python/Numpy
body: <p>I have thousands of polygons given their 4 corner coordinates (quadrilaterals) and would like to convert them to a raster representation as a numpy 2d array.
  A lot of gridding algorithms exist like the popular scanline fill in graphics. (see <a href="http://www.cs.rit.edu/~icss571/filling/how_to.html" rel="nofollow">http://www.cs.rit.edu/~icss571/filling/how_to.html</a> or <a href="http://cs.uvm.edu/~rsnapp/teaching/cs274/lectures/scanlinefill.pdf" rel="nofollow">http://cs.uvm.edu/~rsnapp/teaching/cs274/lectures/scanlinefill.pdf</a> ) </p>
  
  <p>Octave implements this in the poly2mask function (e.g. <a href="http://octave.sourceforge.net/image/function/poly2mask.html" rel="nofollow">http://octave.sourceforge.net/image/function/poly2mask.html</a>). </p>
  
  <p>Is there a similar function also in Numpy?
  I still don't get how this algorithms works in detail and, thus, I would be very grateful if you can give me some hints on how to implement it in Python/Numpy efficiently.</p>
  
  <p>Or would it be better to code it in CPython (which I am not familiar with either) for speed reasons?</p>