Ideas for an algorithm for random distribution of circles in a square

前端 未结 6 724
孤城傲影
孤城傲影 2021-02-08 15:18

I am searching for a concept to distribute circles in a square randomly, so that they dont overlap. All circles are of the same size. The area covered by the circles can be high

6条回答
  •  离开以前
    2021-02-08 15:45

    Start by using the basic algorithm to draw as many as possible circles that don't collide. When it finishes (and it can't reach 200 circles), start pushing in circles. I mean physically push them in with a physics engine: http://www.sgtconker.com/2010/09/article-xna-farseer-platform-physics-tutorial/ (without using gravity).

提交回复
热议问题