// Decompose POV-Ray ' clock' variable (+Kn.n parameter) into // a set of nine binary switches. // This works for parameter values 0.000 -- 0.511 // Paul Prue, illiMath 2006 // p_prue@go.com // Using clock "plus Epsilon" of 0.0001--POV-Ray's int() function can // produce unreliable results otherwise. #declare decimalInt = int ((clock+0.0001) * 1000); #declare dividend = decimalInt; #declare switches = array [9]; #declare counter = 0; #while (counter < 9) #declare remainder = mod(dividend,2); #declare dividend = int(dividend/2); #declare switches[counter] = remainder; #declare counter = counter + 1; #end