camera { location -2*z look_at 0 orthographic } light_source {1000*-z, color 1 rotate 2} plane {-z, -1 pigment {checker color rgb 0.5 color rgb 0.4 scale 0.2}} // The 3 user-defined values: // ( r_1 and r_2 may not be equal nor be zero! ) #declare r_1 = 0.05; // Radius at start point (T=0). #declare r_2 = 0.15; // Radius at end point (T=1). #declare points = 15; // Number of points. // One sphere's radius relative to the previous sphere's radius: #declare M = pow(r_2/r_1,1/(points-1)); // Array to hold radii for all the spheres: #declare r_array = array[points] // Array to hold distribution (T) values between 0 and 1 for each sphere: #declare v_array = array[points] #declare _c = 0; // Counter. #while (_c<=points-2) // Run through all the points but the last. #declare r_array[_c] = r_1*pow(M,_c); // Calculate radius for current point. #declare v_array[_c] = (r_array[_c]-r_1)/(r_2-r_1); // Calculate T value based on radius. #declare _c = _c+1; #end #declare v_array[points-1] = 1; // Last point must always have T value of 1. #declare r_array[_c] = r_2; // Radius of last sphere must be the previous defined one. #declare _c = 0; #while (_c<=points-1) sphere { // Sphere v_array[_c]*2*x-x, // located at the calculated T value r_array[_c] // and with the calculated radius. pigment {color rgb 1} } #declare _c = _c+1; #end