POV-Ray : Newsgroups : povray.newusers : Spheres in a sphere Server Time
31 Oct 2024 21:23:12 EDT (-0400)
  Spheres in a sphere (Message 1 to 10 of 17)  
Goto Latest 10 Messages Next 7 Messages >>>
From: nonostar
Subject: Spheres in a sphere
Date: 16 Mar 2014 07:50:01
Message: <web.53258eddd0bb452612fd452f0@news.povray.org>
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


Post a reply to this message

From: Le Forgeron
Subject: Re: Spheres in a sphere
Date: 16 Mar 2014 12:46:24
Message: <5325d560$1@news.povray.org>
Le 16/03/2014 12:45, nonostar nous fit lire :
> 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
> 
> 

You want to find a solution to apolonian gasket in 3D.

> http://en.wikipedia.org/wiki/Apollonian_gasket

A recursing macro might be a solution to generate smaller and smaller
spheres.

Sadly the pages of Mr Bourke are no more online.

> http://en.wikipedia.org/wiki/Apollonian_sphere_packing


Post a reply to this message

From: nonostar
Subject: Re: Spheres in a sphere
Date: 16 Mar 2014 13:05:00
Message: <web.5325d9299f83cd6812fd452f0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 16/03/2014 12:45, nonostar nous fit lire :
> > 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
> >
> >
>
> You want to find a solution to apolonian gasket in 3D.
>
> > http://en.wikipedia.org/wiki/Apollonian_gasket
>
> A recursing macro might be a solution to generate smaller and smaller
> spheres.
>
> Sadly the pages of Mr Bourke are no more online.
>
> > http://en.wikipedia.org/wiki/Apollonian_sphere_packing

It's less complicated.
In fact i just want to make spheres with a same radius like this :
http://news.povray.org/povray.binaries.images/message/%3Cweb.4d9d10aec2af4450b86cffc90%40news.povray.org%3E/#%3Cweb.4d9
d10aec2af4450b86cffc90%40news.povray.org%3E


Post a reply to this message

From: Samuel Benge
Subject: Re: Spheres in a sphere
Date: 16 Mar 2014 14:45:00
Message: <web.5325f0cb9f83cd68942c68130@news.povray.org>
"nonostar" <nomail@nomail> wrote:
> It's less complicated.
> In fact i just want to make spheres with a same radius like this :
>
http://news.povray.org/povray.binaries.images/message/%3Cweb.4d9d10aec2af4450b86cffc90%40news.povray.org%3E/#%3Cweb.4
d9
> d10aec2af4450b86cffc90%40news.povray.org%3E

Does it matter if the spheres are tightly packed or not?

That image you linked to required testing for intersecting spheres, which can
take quite a while depending on the number of spheres being tested. For that
image I used a program created with voro++, which sped up intersection tests by
finding the spheres' nearest neighbors (so that each sphere didn't have to be
tested against every_other_sphere).

There's another method I just stumbled upon which is even faster, but the
spheres are by no means tightly packed.

Why do you want a sphere full of spheres? What will you be rendering? For things
like filled gumball machines, the methods I mentioned aren't very useful. For
something like a gumball machine, I'd recommend using Blender's physics sim
along with a script I wrote that exports to a POV-Ray array the positions,
sizes, and rotations of all objects in a group. That way you can combine
Blender's physics with POV's perfect geometry (and using less RAM than meshes).

Tell me what you'll be doing, and I'll try to help you out.

Sam


Post a reply to this message

From: green
Subject: Re: Spheres in a sphere
Date: 16 Mar 2014 16:05:01
Message: <web.532602559f83cd68c8e5ee220@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 16/03/2014 12:45, nonostar nous fit lire :
> > 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
> >
> >
>
> You want to find a solution to apolonian gasket in 3D.
>
> > http://en.wikipedia.org/wiki/Apollonian_gasket
>
> A recursing macro might be a solution to generate smaller and smaller
> spheres.
>
> Sadly the pages of Mr Bourke are no more online.
>
> > http://en.wikipedia.org/wiki/Apollonian_sphere_packing

i was just at his site http://paulbourke.net/ because i used his starfield.
his links have not been updated; 'miscellaneous; projection, modeling,
rendering' should be
http://paulbourke.net/miscellaneous/

'interlinked square tori' (jan 2014) works, pretty cool.

green


Post a reply to this message

From: nonostar
Subject: Re: Spheres in a sphere
Date: 16 Mar 2014 16:20:01
Message: <web.532607569f83cd6812fd452f0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 16/03/2014 12:45, nonostar nous fit lire :
> > 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
> >
> >
>
> You want to find a solution to apolonian gasket in 3D.
>
> > http://en.wikipedia.org/wiki/Apollonian_gasket
>
> A recursing macro might be a solution to generate smaller and smaller
> spheres.
>
> Sadly the pages of Mr Bourke are no more online.
>
> > http://en.wikipedia.org/wiki/Apollonian_sphere_packing

Thks but it's less complicated i think.

I just want spheres with the same radius like this :
http://news.povray.org/povray.binaries.images/message/%3Cweb.4d9d10aec2af4450b86cffc90%40news.povray.org%3E/#%3Cweb.4d9
d10aec2af4450b86cffc90%40news.povray.org%3E


Post a reply to this message

From: Alain
Subject: Re: Spheres in a sphere
Date: 16 Mar 2014 16:42:45
Message: <53260cc5@news.povray.org>

> 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

From: nonostar
Subject: Re: Spheres in a sphere
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

From: nonostar
Subject: Re: Spheres in a sphere
Date: 23 Mar 2014 16:05:01
Message: <web.532f3e029f83cd6812fd452f0@news.povray.org>
"nonostar" <nomail@nomail> wrote:
> 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.

Hello

This is that i did. But some sphere are again to gether.
Where is the problem?
I use the function : inside.

#include "rand.inc"
#declare Random_1 = seed (12433);
#declare Tableau=array[3000]
#declare Tableau2=array[3000]
#declare Variable=0;
#while (Variable<3000)
#declare Tableau[Variable]= VRand_In_Sphere(Random_1);
#declare Variable=Variable+1;
#end

#declare VariableX=0;
#declare Variable=1;
#declare S1=Tableau[0];
#declare B1=sphere{S1 0.05 pigment {rgb <1,1,0>}}
#declare Point=Tableau[1]  ;
#while (Variable<3000)
    #while (VariableX<=Variable)
        #if (inside(B1,  Point))
        #declare Tableau2[Variable]=0 ;
        #declare VariableX=VariableX+1;
        #declare S1=Tableau[VariableX];
        #else
        #declare Tableau2[Variable]=0.05;
        #end
    #declare VariableX=VariableX+1;
    #end
    #declare Variable=Variable+1;

#end
//---------------------------------------------------------

#declare Variable=1;
#declare Variable2=1;
#while (Variable<3000)
#declare S2=Tableau[Variable];
#declare S3=Tableau2[Variable];
sphere{S2 S3 pigment{rgb<1,1,0>}}
#declare Variable=Variable+1;
#declare Variable2=Variable2+1;
#end


Can you help me?

Thanks


Post a reply to this message

From: nonostar
Subject: Re: Spheres in a sphere
Date: 24 Mar 2014 10:05:01
Message: <web.53303aad9f83cd68419a77410@news.povray.org>
I tried to improve this.

But i get a problem.
When i ran i had this message : "Attempt to access unitialized array elemement"
for this line :

 #declare Point=ArrayPosition[Variable2];


i give you my code.

#include "rand.inc"
#declare Random_1 = seed (12433);
#declare ArrayPosition=array[3000]
#declare ArrayRayon=array[3000]
#declare Variable=0;

#while (Variable<30)
        #declare ArrayPosition[Variable]=VRand_In_Sphere(Random_1);
        #declare ArrayRayon[Variable]=0.05;
        #declare Variable=Variable+1;
#end

#declare Variable1=0;
#declare Variable2=1;

#declare Object=sphere{ArrayPosition[Variable1] ArrayRayon[Variable1] pigment
{rgb <1,1,0>}};
#declare Point=ArrayPosition[Variable2];

#while (Variable2<3000)
        #while (Variable1<Variable2)
                #if(inside(Object,Point))
                #declare ArrayRayon[Variable2]=0;
                #declare Variable1=Variable2;
                #else
                #declare Variable1=Variable1+1;
                #declare Object=sphere{ArrayPosition[Variable1]
ArrayRayon[Variable1] pigment {rgb <1,1,0>}};
                #end
        #end
        #declare Variable2=(Variable2+1);
        #declare Variable1=0;
        #declare Object=sphere{ArrayPosition[Variable1] ArrayRayon[Variable1]
pigment {rgb <1,1,0>}};
        #declare Point=ArrayPosition[Variable2];

#end

#declare Variable=0;
#while (Variable<3000)
sphere{ArrayPosition[Variable] ArrayRayon[Variable] pigment {rgb <1,1,0>}}
#declare Variable=Variable+1;
#end


where is the mistake ?

I don't understand.

Thanks for your help


Post a reply to this message

Goto Latest 10 Messages Next 7 Messages >>>

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