# Generate evenly spaced points on 2D graph

I want to draw dots on an image that is W by W pixels. The image is stored as a 1-D array of pixels. The pixel (x,y) is at array index x + y * W. I am thinking that I can use a fixed step size, N, and draw a dot at every Nth pixel. What value of N will produce equilateral triangles?

Here is the result using W = 100 and N = 673

As you can see the triangles formed are nearly equilateral. Given W, how can I find "good" values for N, which will form near equilateral triangles?

• Are there any constraints (e.g. upper or lower limit) regarding the number of produced triangles? Commented Oct 9, 2014 at 18:41
• No constraints. N and W must be positive integers. If you plot the minimum distance between any two points as a function of N (with W fixed), you can see the function has many maxima. The "nearly equilateral triangles" correspond to the maxima. I'd like to predict what the maxima will be for a given W. Commented Oct 9, 2014 at 21:55
• On second thought, allowing N and W to be Real won't change the answer, and it might be easier to solve. Given W and index I = k*N, the coordinates of the point is (x,y) where x is the remainder and y is the quotient, of I/W. (So I guess y is an integer, but x needn't be). Commented Oct 10, 2014 at 12:52