First, note that a five-sided star, like that on the US flag, can be constructed as follows:
If you take a regular pentagon (thick black lines) and connect all the vertices (numbered blue dots), you sketch a star. Alternatively, if you start with one vertex, and, traveling in a counter-clockwise direction, skip a vertex and connect the two, and repeat you get the same thing (i.e. line from 1 to 3, then 3 to 5, then 5 to 2, then 2 to 4, then 4 to 1).
However, to sketch the perimeter of the star, you also need to include the lettered vertices of the smaller, red, pentagon which is formed by the inscribed star. To get the resulting star shape, you need to connect the vertices in order:
The way I did this in Mathematica was using complex notation. The corners of the pentagons in the Complex Plane are given by
Argument. All this is pretty easy to do in Mathematica:
starVert = (#1[[Ordering[Arg[#1]]]] & )[Join[E^(I*(Pi/10))*Exp[2*2*Range*Pi*(I/5)], (1/2)*(3 - Sqrt)*E^(I*(Pi + Pi/10))*Exp[2*Range*Pi*(I/5)]]]
Then I just mapped Re[coords] to x and Im[coords] to y, tiled the stars on the flag, and:
But, I wanted to make the flag wave. To do that, I summed 7 time-dependent sin curves in 2D with (bounded) random wavevector and frequencies. A resulting surface looks like this, for example:
This was the one I submitted for the contest. Since then, I've seen Eric Brodeur's amazing Mathematica flag:
which is far better than the one I submitted. I'm not sure why I decided to do a top-down view, rather than the side view (also, I'm not sure how he got rid of framing boxes around the surface). Anyway, it's been fun.