0

Is there an Algorithm/Technique that can be used to place items where the spacing between items is at best evenly distributed.

For example I have circles with varying sizes (radius) that can be be placed in a rectangle box (grid) , where the y coordinate is already fixed, and the circles can only be moved horizontally (by varying the x-coordinate). Are there algorithms/techniques that can place the circles evenly.

Here is an example of how they might be initially set, and after processing where those items ideally should end up (note the y-values are fixed).

example what I mean by items best evenly distributed

ATM I am thinking of going through each item individually and calculating the distance from the other items and adding the total distances, for all items. Then running through all the possible possible layouts and using the largest total distance as the optimal layout. But this seems inefficient.

I have heard of Force Directed Layout but it seems overkill for this, and I am not sure if that allows you to fix points in one dimension.

thanks

pt123
  • 2,146
  • 1
  • 32
  • 57
  • 3
    what is the objective? closest spacing, widest spacing, or most balanced visual layout for a human observer? I don't see how the "After Processing" example above is evenly spaced. – Andras Dec 01 '14 at 00:43
  • they are fixed on the y-axis, widest distance between the items, and ideally the borders this should translate into a more balanced visual layout for human observer – pt123 Dec 01 '14 at 00:51
  • @pt123: "more balanced visual layout" isn't an objective function; think harder. BTW, maximising the total distance between all pairs probably won't be ideal: that would put the yellow and blue balls flush left, and the orange and green balls flush right. – j_random_hacker Dec 01 '14 at 01:21
  • you have to weight the distances between them, so something like a Force could be used, the question is about if there is a method technique to doing, I am not looking for a precise solution. – pt123 Dec 01 '14 at 01:36
  • @pt123 use force fields (attract/repel) for this take a look here http://stackoverflow.com/a/18693107/2521214 and most definelly at the first two sublinks there (in bullet 4 field approaches) – Spektre Dec 01 '14 at 08:18

0 Answers0