Randomly Uniformly Sized 3D Shape Generation

10 ビュー (過去 30 日間)
Yang Shi
Yang Shi 2017 年 2 月 22 日
コメント済み: Yang Shi 2017 年 2 月 23 日
I'm trying to generate a bunch of small spheres in a unit bounding box, with each sphere from .1 to .2 in size. A constraint prohibits centers of spheres to be too close to each other. Thus, as spheres fill up the box, smaller volumes are available that favor small sized spheres. In other words, after the box is filled sufficiently, there are many more small sized spheres than large.
Is there a way to guarantee an approximately uniform distribution of cube sizes?

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 2 月 23 日
Since volume is proportional to the cube of the radius, the .2 spheres are 8 times the volume of the .1 spheres. If your selection process is to generate a random size and a random location and see if it fits, and try again with a different size and location if not, then obviously you are going to be 8 times as likely to fit a small sphere as a large one.
A completely different approach is to choose the number of spheres and their sizes ahead of time, and then to see if you can find some way that fits them in the given container. The following page describes that in terms of "shaking": http://www2.latech.edu/~jkanno/packing.pdf
One approach would be to treat constraint distance as solid spheres of uniform size, and place those, and then after replace with spheres of the actual size. That might not be as dense as possible though.
Another approach might be to treat the spheres as movable, and that when you drop a new probe sphere in, that you say that it pushes the surrounding spheres aside (and that in turn might push on other spheres, and so on), each time the surrounding spheres adjusting their positions to try to fit. The walls of the box would be important as those would provide an immovable object that would provide a counter-reaction preventing some movement, which might in turn require the stresses travel a different way. This all might not be all that simple to program, but it would be somewhat realistic. It would have the difficulty, though, that it the spheres would tend to end up touching (because they only move far enough to fit the newcomer.) If you are looking for a solution in which the spheres tended to be separated, then this would probably not do the trick.
  1 件のコメント
Yang Shi
Yang Shi 2017 年 2 月 23 日
Thank you for the reply. The ppt slide was easy to read and helpful. I'd like all spheres to touch and form a single solid body, though small isolated groups are fine. Currently, the code ensures that spheres aren't overlapping too much and that each sphere touches at least another sphere. The first condition, as you explained, favors small spheres but the second condition favors large spheres. I've been basically trying a variety of sphere size distributions, bounding box size, etc. for the overall distribution to be uniform. This doesn't gaurantee a single solid model in the end, however. Will attempt the more physics based approach! Also, how would this change if the spheres were cubes?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by