POV-Ray : Newsgroups : povray.general : Random Colour picker for spheres : Random Colour picker for spheres Server Time
14 Aug 2024 05:21:37 EDT (-0400)
  Random Colour picker for spheres  
From: Zack Halbrecht
Date: 22 Feb 1970 23:46:19
Message: <01bd4014$038df340$0bab0680@zack>
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.?
Im trying to use a switch statement like this but obviously not working.

#declare loop_iterator = 0
#while (loop_iterator <= (4 * PI))

#declare color1 = Orange
#declare color2 = Green
#declare color3 = Yellow
#declare color4 = Blue
#declare cx = Black
#declare cy = Black

object

#switch (s1)
        #case (0)
        cx = color1
        #end
        #case (1)
        cx = color2
        #end
        #case (2)
        cx = color3
        #end
        #case (3)
        cx = color4
#end        

#switch (s2)
        #case (0)
        cy = color1
        #end
        #case (1)
        cy = color2
        #end
        #case (2)
        cy = color3
        #end
        #case (3)
        cy = color4
#end        



  sphere { <sin(loop_iterator),loop_iterator,loop_iterator>, 1 pigment {
Sapphire_Agate } }
  sphere { <sin(loop_iterator) -5,loop_iterator,loop_iterator>,1 pigment {
color Yellow } }


#declare loop_iterator = loop_iterator + 2
#end

Can anyone help?

thanks in advance


-- 
Zack Halbrecht
Head Procrastinator
Rutgers University
zac### [at] edenrutgersedu


Post a reply to this message

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