Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a rectangle R of width W and height H.
I have N points inside this rectangle.
I need to find an algorithm to position my points in the rectangle in the most uniform way possible (no overlaps, max area coverage, uniform density).
So the output of the algorithm should be a list of coordinates.

Here's some examples with different rectangles and points:


examples

Any help?

share|improve this question
1  
Off-topic here, I am afraid. –  Sasha Apr 19 '13 at 14:08
    
Oh i'm sorry about that... what's the proper place for this question? –  Oneiros Apr 19 '13 at 14:56
    
@Sasha: It isn't Off-topic. A question of Graph theory and co-ordinate system. –  user63477 Apr 19 '13 at 15:12
3  
You can think of it as packing circles into rectangles, where the radius is half the distance between the points. These problems are hard. This is a duplicate of this question which gives some references. –  Ross Millikan Apr 19 '13 at 15:23
    
@RossMillikan, nice way to think of the problem! +1 –  Parth Thakkar Apr 19 '13 at 15:30
show 4 more comments

1 Answer

Maybe you should create a library of pleasing patterns to choose from. The easiest are rectangular grids. Choose one that has enough dots (maybe a few too many) and aspect ratio close to the rectangle you have to put the dots in. Say your rectangle is $1 \times 3$ and you want $20$ dots. You could make a grid of $2 \times 10$ or $4 \times 5$ but they don't fit very well, so maybe you use $3 \times 7$ with one left out. In this case, if your grid is $n \times m$, you have $n-1$ full spaces between thee dots and 2 half spaces between the dots and the edge, so that gives you the spacing.

A little harder is the pattern on the far right. This would be a nice idea for $20$ dots. You can put the dots on the corners of equilateral triangles, for example.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.