 <p>There is an equation given <a href="http://math.stackexchange.com/questions/41940/is-there-an-equation-to-describe-regular-polygons/41946#41946">here</a> (the last one).</p> <p>By looping over all the x and y coordinates, and checking that the output of this equation is less than zero, you can determine which points are 'inside' and colour them appropraitely.</p>