开发者

random layout algorithm

Given a number N and a rectangle, I'm looking for an algorithm that will 'randomly, but aesth开发者_高级运维etically' 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!


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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜