Hmm. I think generating the centers is not so hard. All the centers for one triangular section lie along the points<p><pre><code> (x,y) = i * u1 + j * u2
</code></pre>
where (i,j) are nonnegative integers and the basis vectors u1 and u2 are:<p><pre><code> u1 = (1,0)
u2 = (1/2, sqrt(3)/2)
</code></pre>
There is a 1:1 correspondence of (i,j) to centers, so you could generate all centers with a nested for loop.<p>If you want to generate all centers in the hexagon (not just the triangle) and still preserve the 1:1 nature of the map from (i,j) to (x,y), you could just rotate 6 times by 60 degrees each time.<p>Doing just this would introduce duplicates along the edges, where the triangular segments abut each other. You could eliminate those by insisting that i>0 rather than just i>=0.<p>You could get the same effect as rotation by introducing a third basis vector u3, but then there would be duplicates in the map from (i,j,k) -> (x,y).