#include "colors.inc" #include "textures.inc" #include "metals.inc" /* macro to draw a clock with one sweeping hand (one cycle in per clock cycle) usage make_clock(cc) This creates an object whose square base is at origin 2 units by 2 units wide. the clock faces are 1 unit in radius, 4 faces at an altitude of about 10 units. The entire body is about 12 units high */ #macro make_clock(cc) union{ #local faced = union{ //clock face cylinder { <0, 0, 0>, <0, 0, .1>, 1 pigment{color rgb <1, 1, 1>}} #local i = 1; #local tic_width = .04; #local tic_height = .2; #local tic_depth = .01; #while (i<=12) box { <-tic_width/2, 0, 0>, pigment{color rgb <1, .2, .2>} translate y*.7 rotate z*i*30} #local i = i+1; #end //clock hand merge { cylinder { <0, -.1, 0>, <0, .7, 0>, .08 } cone { <0, .7, 0>, 0.25, <0, .9, 0>, .001 } pigment{color rgb <.2, .2, 1>} scale <1,1,.1> translate -z*1.1*tic_depth rotate -cc*z*360 } //clock hand post cylinder { <0, 0, 0>, <0, 0, -.02>, .02 pigment{color rgb <0, 0, 0>}} } object{faced translate -1.1*z rotate +0*y} object{faced translate -1.1*z rotate +90*y} object{faced translate -1.1*z rotate -90*y} object{faced translate -1.1*z rotate +180*y} //box union{ difference{ box{-<1.2,1.2,1.2>,<1.2,1.2,1.2>} //box{<-1.2,-1.2,-1.2>,<1.2,1.2,1.2>} union{ cylinder{<0,0,-1.8>,<0,0,1.8>,1} cylinder{<-1.8,0,0>,<1.8,0,0>,1} } } cone{1.2*y,1.2,3*y,0} cone{-1.2*y,1.1,-2*y,.3} cylinder{-2*y,-6*y,.3} cone{-6*y,.3,-6.8*y,1.4} box{<-1.4,-6.8,-1.4>,<1.4,-6.8-2,1.4>} texture{T_Brass_3B} } translate y*8.8} #end