POV-Ray : Newsgroups : povray.general : Spiraling objects. : Re: Spiraling objects. Server Time
10 Aug 2024 01:28:04 EDT (-0400)
  Re: Spiraling objects.  
From: Bill DeWitt
Date: 31 Mar 2000 15:26:46
Message: <38e50a06$1@news.povray.org>
"Wil Hale" <whh### [at] nvlarmymil> wrote in message
news:38e4f901$1@news.povray.org...
> I thinks this is too advanced to put in new users so here it is.
>
> Been trying to figure out how to do a spiral of spheres (or boxes or
> anything)  Starting with a close sphere and generating the other spheres
at
> appropriate xyz locations depending on whether i wanted the spiral to move
> away or closer.
>
> It seems I could do this with a #while statement but the coding eludes me.
>

/* Here's the sort of thing I do. I use the sin/cos because it is easier to
control the radius if you want something other than a circular spiral. It
does require that you rotate the object if you want them all to face out...
*/


#declare Object = union {
                         sphere { 0, 0.20
                           pigment { rgb < 1.0, 0.0, 0.0 > }
                                      } // end sphere
                         sphere { 0, 0.075
                           pigment { rgb < 1.0, 0.0, 0.0 > }
                           translate < 0.0, 0.0, 0.2 >
                                      } // end sphere
                        } // end union

#declare NumberofObjects = 150;
#declare NumberofLoops = 5;
#declare XRadius = 2;
#declare ZRadius = 2;
#declare Height = 3

#declare I = 0;
#while ( I <= NumberofLoops )
    object { Object
               rotate < 0.0, 360*I, 0.0 >
               translate < sin(I*(2*pi))*XRadius,
                           ((Height/NumberofLoops)*I),
                           cos(I*(2*pi))*ZRadius >
           } // end object

#declare I = I + 1/(NumberofObjects/NumberofLoops);
#end


Post a reply to this message

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