POV-Ray : Newsgroups : povray.newusers : Spheres in a sphere : Re: Spheres in a sphere Server Time
13 May 2024 23:54:16 EDT (-0400)
  Re: Spheres in a sphere  
From: nonostar
Date: 17 Mar 2014 14:50:00
Message: <web.532742e39f83cd6812fd452f0@news.povray.org>
Alain <kua### [at] videotronca> wrote:

> > 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

Thanks for these answers.
I will try to do it step by step with time because i am a new user on this
software.
i inform you.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.