// Some decorative elements // Last edited on 2005-08-28 15:11:06 by stolfi #macro treoid(pos, tree_height, tree_radius) #local bot = pos - 1.0*z; #local top = bot + (tree_height - 2*tree_radius + 0.01)*z; #local ctr = bot + (tree_height - tree_radius)*z; union { cylinder { bot, top, 0.10 texture { tx_trunk } } sphere { ctr, tree_radius texture { tx_leaves } } } #end #macro tree_ring(K, ring_radius, tree_height) #local tx_trunk = texture { pigment { color rgb < 0.500, 0.200, 0.000 > } finish { diffuse 0.8 ambient 0.2 } } #local tx_leaves = texture { pigment { color rgb < 0.400, 0.800, 0.000 > } finish { diffuse 0.8 ambient 0.2 } } #local sv = < ring_radius, 0, 0 >; #local gen = seed(4615); union { #local i = 0; #while(i < K) #local dx = 0.30*(2*rand(gen)-1); #local dy = 0.30*(2*rand(gen)-1); treoid(vrotate(sv, i*360/K*z) + < dx, dy, 0 >, 1.50, 0.50) #local i = i+1; #end } #end