|
![](/i/fill.gif) |
In article <38e4f901$1@news.povray.org>, "Wil Hale"
<whh### [at] nvl army mil> wrote:
> I thinks this is too advanced to put in new users so here it is.
This is one of the reasons "povray.advanced-users" was created... :-)
> 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.
A #while loop is the best way to do it. You can also wrap it in a macro,
to save typing and avoid duplicated code.
#macro Spiral(Obj, Num, StartRadius, StopRadius, Revolutions)
union {
#local J=0;
#while(J<Num)
object {Obj
translate x*((StopRadius-StartRadius)
*J/(Num-1)+StartRadius)
rotate y*Revolutions*360*J/(Num-1)
}
#local J=J+1;
#end
// the } is left off the union so specific transformations,
// texture, etc. can be specified more easily.
#end
An example of using this macro:
#declare TestObject = sphere {< 0, 0, 0 >, 0.1}
Spiral(TestObject, 350, 2, 3, 3)
texture {
pigment {color White}
}
rotate y*90
}
--
Christopher James Huff - Personal e-mail: chr### [at] yahoo com
TAG(Technical Assistance Group) e-mail: chr### [at] tag povray org
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
![](/i/fill.gif) |