|
 |
Hi Dave
#if (clock<=1)
translate <0, clock*20, 0>
#else
#if (1<clock<=2)
#declare elseclock = clock-1
translate <0, 20, 0>
rotate <0, 0, ((clock-1)*180)>
#else
#if (2<clock<=3)
translate <0, -20, 0>
#else
#if (clock<=4)
#declare elsclock= clock-3
translate (-20+(20*(clock-3)))*y
#end
#end
#end
#end
Why it doesn't work: (or so I believe)
(1<clock<=2)
pov first evaluates 1<clock and returns either false (=0) or true
(=1), then it check the resulting boolean<=2, which is always true...
you should write ((1<clock)&(clock<=2)).
However, there is a simpler way to do this: #switch
#switch (clock) // use clock for all tests
#range (0,1) // if 0<=clock<=1, then...
translate <0, clock*20, 0>
#break //<-- this exit the #switch test, so #range(1,2) isn't used
too when clock=1
#range (1,2)
translate <0, 20, 0>
rotate <0, 0, ((clock-1)*180)>
#break
#range (2,3)
translate <0, -20, 0>
#break
#range (3,4)
translate (-20+(20*(clock-3)))*y
#break // this one isn't necessary... but it is neater this way.
#else
#error "\nClock out of range" // just for fun
#end // close the #switch directive
#switch uses also #case(aValue), but in this case this isn't very
usefull - except if you want subliminal images :-) See the doc.
Hope this helps,
Povingly,
Philippe
Post a reply to this message
|
 |