|
|
Zack Halbrecht (zac### [at] edenrutgersedu) wrote:
> Hey there everyone, i ve got what seemed to me like a pretty basic problem.
> I have a while loop going and want it to draw a series of spheres. How can
> i
> get it to pick a random color out of four which i determine.?
I suggest using the rand() function (assuming you're using POV 3) combined
with a switch (too tired now to check the syntax in the docs, but sure it
lays there):
#declare loop_iterator = begin_iterator
#while (iterator < end_iterator)
#declare A = rand()
#declare B = rand()
#switch (A)
#range (0,0.25)
#declare cx = colour Orange
#break
#range (0.25,0.5)
#declare cx = colour Green
#break
#etc...
#end
#switch (B)
#same here
#end
#sphere { ... texture { pigment { colour cx } } }
#sphere { ... texture { pigment { colour cy } } }
#declare iterator = iterator + increment
#end // #while ()
Happy ray-tracing,
B-o-b.
--
bob### [at] casimirrezelenstfr -- Linux, POV-Ray, LaTeX
Post a reply to this message
|
|