Reputation: 1091
Given a standard nested circular treemap, how do you calculate the where to place the circles?
Upvotes: 5
Views: 888
Reputation: 31614
Your main problem can be described as this: "Given a set of circles of varying radius, how does one place them within a larger circle, so that none of them overlap
".
It's a hard problem, but here's a brute force solution to get you started:
The above uses the observation that in a perfect packing, every circle must border to at least two other circles. You can use the algorithm to provide a full search, or you can just iterate randomly and greedily choose the first available spot.
Upvotes: 1