/* Tetraedic Space Division - Jan Engelhardt , 2007 */ #include "colors.inc" #local thick_node = 0.1; #local thick_edge = 0.02; #local color_node = color rgbt <0.3, 0, 0.8, .7>; #local color_edge = color rgbt <0.4, 0, 0.7, .7>; #local levels = 30; /* needs to be >= 3 */ #local sin_60 = sin(radians(60)); #local cos_60 = cos(radians(60)); #local ambient_level = 0.8; #macro tetra_node(pos) #local nf = 1.99; sphere { pos, thick_node pigment { color color_node } finish { specular 1 ambient ambient_level } } cylinder { pos - x / 2, pos + x / 2, thick_edge pigment { color color_edge } finish { specular 1 ambient ambient_level } } cylinder { pos - / nf, pos + / nf, thick_edge pigment { color color_edge } finish { specular 1 ambient ambient_level } } cylinder { pos - <-cos_60, sin_60, 0> / nf, pos + <-cos_60, sin_60, 0> / nf, thick_edge pigment { color color_edge } finish { specular 1 ambient ambient_level } } cylinder { pos - / nf, pos + / nf, thick_edge pigment { color color_edge } finish { specular 1 ambient ambient_level } } cylinder { pos - <-cos_60, sin_60 / 2, sin_60> / nf, pos + <-cos_60, sin_60 / 2, sin_60> / nf, thick_edge pigment { color color_edge } finish { specular 1 ambient ambient_level } } cylinder { pos - <0, -sin_60 / 2, sin_60> / nf, pos + <0, -sin_60 / 2, sin_60> / nf, thick_edge pigment { color color_edge } finish { specular 1 ambient ambient_level } } #end #macro tetra_space() union { #local zz = 0; #while (zz < levels) #local yy = zz; #while (yy < levels) #local xx = yy; #while (xx < levels) tetra_node() #local xx = xx + 1; #end #local yy = yy + 1; #end #local zz = zz + 1; #end } #end tetra_space() #local local_light = array[9] { <0, 0, 0>, <-1000, -1000, -1000>, <-1000, -1000, 1000>, <-1000, 1000, -1000>, <-1000, 1000, 1000>, < 1000, -1000, -1000>, < 1000, -1000, 1000>, < 1000, 1000, -1000>, < 1000, 1000, 1000>, } #local i = 1; #while (i < dimension_size(local_light, 1)) light_source { local_light[i] color White } #local i = i + 1; #end camera { #local at_target = ; /* * Location: node @(x=1,y=1,z=0) */ location at_target / 2 + thick_node*1.01 /* * Look at: (@(n,0,0)+@(n,n,0)+@(n,n,n))/3 * (Right plane) */ look_at at_target } background { color Black }