|
|
> Hello,
>
> i want to make spheres in a sphere. I know there is a function for that :
> VRand_In_Obj.
>
> But i want to prevent the intersection of spheres between them.
>
> How can i do proceed to do that ?
>
> Thanks for your help
>
>
A common and simple solution for equaly sized spheres:
Create an array large enough to contain the locations of all your spheres.
Randomly place about 10 to 100 spheres. Make sure that the new spheres
are located at twice the individual radius. Each acceptable location is
placed in the array.
Make an union of test spheres, each having twice the radius of your
intended spheres.
Now, for the next spheres, start with an insideness test against that
union. There is an is_inside function that return 0 if outside an object
and 1 if inside.
Continue for another batch of spheres that will also be used to create
another union.
Repeat untill you have all yours spheres, or you need to many tries to
find a suitable location.
Finaly, using the locations from your array, place the actual spheres.
Using a bunch of unions of double sized spheres is much faster than
testing for every previous spheres.
This don't ensure the most optimum packing, but ensure that all spheres
are non-intersecting.
If you search in povray.binaries.scene-files, you can find some working
code made exactly for that purpose.
Alain
Post a reply to this message
|
|