#macro sample_contents(tray_idim) // Sample contents for a drawer or similar storage space. // {tray_idim} is the useful size of the drawer's cavity. #local tx_can = texture{ pigment{ color rgb < 1.000, 0.200, 0.000 > filter 0.200 } finish{ diffuse 0.780 ambient 0.020 specular 0.250 roughness 0.005 } } #local tx_lid = texture{ pigment{ color rgb < 1.000, 0.800, 0.000 > } finish{ diffuse 0.900 reflection 0.000 ambient 0.050 specular 0.250 roughness 0.020 } } #local can_skosh = 1; #local can_rad = 30; #local lid_ht = 10; #local can_ht = tray_idim.z - can_skosh - lid_ht; #local can = cylinder{ < 0, 0, eps >, < 0, 0, can_ht - eps >, can_rad - eps texture{ tx_can } } #local lid = cylinder{ < 0, 0, eps >, < 0, 0, lid_ht - eps >, can_rad - eps texture{ tx_lid } } #local can_with_lid = union{ object{ can } object{ lid translate can_ht*z } } #local can00 = object{ can_with_lid translate < can_rad, can_rad, 0 > + can_skosh * < 1, 1, 0 > } #local can10 = object{ can00 translate (tray_idim.x - 2*(can_rad + can_skosh))*x } #local can01 = object{ can00 translate (tray_idim.y - 2*(can_rad + can_skosh))*y } #local can11 = object{ can10 translate (tray_idim.y - 2*(can_rad + can_skosh))*y } #local contents = union{ object{ can00 } object{ can10 } object{ can01 } object{ can11 } } contents #end