// Last edited on 2010-10-14 18:28:38 by stolfilocal // A light gauge (painted ping-pong ball) in its muffin-tray baffle // Caller must define light_ambient (min 0.0 max 1.0) // DIMENSIONS // All dimensions in millimeters #declare LG_ball_radius = 20.2; // Including paint layer. #declare LG_baffle_out_bot_radius = 22.5; // To be confirmed. #declare LG_baffle_out_top_radius = 35.0; // Excluding lip. #declare LG_baffle_lip_width = 3.5; // Rounded lip width. #declare LG_baffle_height = 30.0; // Including lip. #declare LG_baffle_thickness = 2.0; // Including the velvet lining. #declare LG_baffle_tack_height = 1.5; // Height of ball bottom above outer baffle bottom. // Compute the inner radii of the baffle: #local dR = LG_baffle_out_top_radius - LG_baffle_out_bot_radius; #local h = LG_baffle_height; #local cos1 = h/sqrt(dR*dR + h*h); #local sin1 = dR/sqrt(dR*dR + h*h); #local tR = LG_baffle_thickness/cos1; #local lip_r = LG_baffle_lip_width/2; #local lip_R = LG_baffle_out_top_radius + 0.7*lip_r; #declare LG_baffle_in_bot_radius = LG_baffle_out_bot_radius - tR + LG_baffle_thickness*sin1; #declare LG_baffle_in_top_radius = LG_baffle_out_top_radius - tR; #local eps = 0.01; // Fudge perturbation to avoid coincident surfaces. // TEXTURES #declare LG_baffle_cup_texture = texture{ pigment{ rgb < 0.030, 0.030, 0.030 > } finish{ ambient light_ambient diffuse 1.0 - light_ambient } } #declare LG_baffle_velvet_texture = texture{ pigment{ rgb < 0.020, 0.020, 0.020 >} finish{ ambient light_ambient diffuse 1.0 - light_ambient } } // OBJECTS #declare light_gauge_baffle = // Empty light baffle. // The baffle is centered on the Z axis with bottom at Z=0. union{ difference{ cone{ <0,0,0+eps>, LG_baffle_out_bot_radius-eps, <0,0,LG_baffle_height-eps>, LG_baffle_out_top_radius-eps texture{ LG_baffle_cup_texture } } cone{ <0,0,LG_baffle_thickness-eps>, LG_baffle_in_bot_radius+eps, <0,0,LG_baffle_height+eps>, LG_baffle_in_top_radius+eps texture{ LG_baffle_velvet_texture } } } torus{ lip_R,lip_r rotate 90*x translate (LG_baffle_height - lip_r)*z texture{ LG_baffle_cup_texture } } } #declare light_gauge_ball = // Naked light gauge (white-painted ping-pong ball). // The ball is centered on the Z-axis with the BOTTOM on the origin. object{ pong_ball_painted_white translate BL_pong_ball_painted_radius*z } #macro light_gauge_in_baffle(baf_dx,baf_dy) // Light gauge nested in light baffle. // The ball is centered on the Z axis, with bottom at {Z=LG_baffle_tack_height}. // The baffle is centered on {(baf_dx,baf_dy)} with bottom at Z=0. union{ object{ light_gauge_baffle translate } object{ pong_ball_painted_white translate LG_baffle_tack_height*z } } #end