#declare CLOCK = clock;
//#declare CLOCK = 1;
#declare BEARING = int(CLOCK / 8) * 45;
#declare ELEVATION = mod(CLOCK, 8) * 45;
#declare RADIUS = 2;
#declare N_VERTEX = 16;
plane { <0,1,0> 0 pigment { rgb<1,1,1> } translate<0,-4,0> }
/*
plane { <0,1,0> 0 pigment { checker <0.8,0.8,0.8> rgb<1,1,1> }
translate<0,-2,0> }
union { /// axes
cone { <-1,0,0> 0.5 <1,0,0> 0.1 pigment { rgb <1,0,0> } }
cone { <0,-1,0> 0.5 <0,1,0> 0.1 pigment { rgb <0,1,0> } }
cone { <0,0,-1> 0.5 <0,0,1> 0.1 pigment { rgb <0,0,1> } }
scale 2
}
*/
#declare HALF_SEPARATIONS = array[2]{0 , RADIUS / sqrt(2)};
#declare CENTROID_X = array[2]{4, -2};
#local I = 0;
#while (I < 2)
#local HALF_SEPARATION = HALF_SEPARATIONS[I];
#if (HALF_SEPARATION = 0)
#local ANGLE_MAX = pi / 2;
#local PEAK_X = 0;
#else
#local ANGLE_MAX = acos(-RADIUS / (RADIUS + 2 * HALF_SEPARATION));
#local PEAK_X = RADIUS * RADIUS / (RADIUS + 2 * HALF_SEPARATION)
- HALF_SEPARATION;
#end
#local EIGHTH =
union {
#local T = 0;
#while (T < N_VERTEX)
#local T = T + 1;
#local ANGLE_T = T / N_VERTEX * ANGLE_MAX;
#local ANGLE_T_1 = (T - 1) / N_VERTEX * ANGLE_MAX;
triangle {
< HALF_SEPARATION + RADIUS * cos(ANGLE_T ), 0, RADIUS * sin(ANGLE_T )>,
< HALF_SEPARATION + RADIUS * cos(ANGLE_T_1), 0, RADIUS * sin(ANGLE_T_1)>,
< PEAK_X, RADIUS * sin(ANGLE_MAX), 0>
#if (mod(T / N_VERTEX * 8, 3) > 1)
pigment { rgb<0.9,0.7,0.5> }
#else
pigment { rgb<0.7,0.6,0.5> }
#end
}
#end
}
#local HALF =
union {
object { EIGHTH }
object { EIGHTH scale<1, 1,-1> }
object { EIGHTH scale<1,-1, 1> }
object { EIGHTH scale<1,-1,-1> }
}
union {
object { HALF }
object { HALF scale<-1,1,1> rotate<90,0,0> }
rotate <0 ,BEARING,0 >
rotate <0,0 ,ELEVATION >
translate <0 ,0 ,CENTROID_X[I]>
}
#local I = I + 1;
#end
camera {
right x * image_width / image_height
location <20,0,0>
look_at <0,0,0>
angle 30 * image_width / image_height
}
union {
light_source {
<10,10,0> color 0.5
area_light <0,3,0>, <0,0,1>, 3, 3
adaptive 1 circular
}
}
global_settings { ambient_light rgb <9,9,9> }
background { color rgb <0.9,0.9,0.9> }