|
![](/i/fill.gif) |
"Wil Hale" <whh### [at] nvl army mil> 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
|
![](/i/fill.gif) |