Colin
Colin

Reputation: 3752

random layout algorithm

Given a number N and a rectangle, I'm looking for an algorithm that will 'randomly, but aesthetically' distribute N points in the rectangle.

This isn't really a graph layout problem, afaik, because it's not a graph - I just have N identical things (circles, pictures, whatever) I want to put in the rectangle. The result should be randomized, but still be aesthetically pleasing; things shouldn't bunch up too much, but also shouldn't be too 'orderly' (not sure how to define that precisely). N will typically be fairly small (< 10).

Any ideas/links?

thanks!

Upvotes: 2

Views: 542

Answers (3)

Colin
Colin

Reputation: 3752

I did something similar to what's described here: randomly distribute points, perturb them maximizing nearest neighbor distance with smaller and smaller increments for some iterations. The link describes doing millions of iterations, but I found after 8 or so, things look pretty good.

Upvotes: 1

mhum
mhum

Reputation: 2968

You may want to check out Low-discrepancy Sequences (aka Quasi-random sequences).

Upvotes: 1

edmz
edmz

Reputation: 3360

Imagine your rectangle has a grid. Every one of this objects will snap to that grid. But that would leave you with a equally distant objects, correct? Well, just add a random x,y offset to each of the object positions.

Upvotes: 0

Related Questions