// Last edited on 2010-10-15 14:50:27 by stolfilocal // A light diretion gauge consisting of a shiny black snooker ball on a base. // Caller must define light_ambient (min 0.0 max 1.0) // DIMENSIONS // All dimensions in millimeters // The background disk: #declare NG_base_radius = 37.5; #declare NG_base_height = 0.5; #declare NG_base_color = < 0.500, 0.500, 0.500 >; // The pedestal under the ball: #declare NG_holder_radius = 8.0; // Arbitrary. #declare NG_holder_height = 0.3; // From bottom of ball to top of base. #local eps = 0.01; // Fudge perturbation to avoid coincident surfaces. // TEXTURES #declare NG_base_texture = texture{ pigment{ rgb NG_base_color } finish{ ambient light_ambient diffuse 1.0 - light_ambient } } #declare NG_holder_texture = BL_plastic_texture( < 0.2000, 0.4000, 1.0000 >, 0.050, 0.010 ) // OBJECTS #declare snook_gauge_holder = // Base for the white pool ball target. // The base is modeled by a cylinder with a spherical cavity. difference{ cylinder{ <0,0,0+eps>, <0,0,NG_holder_height+BL_snooker_ball_radius>, NG_holder_radius-eps } sphere{ <0,0,NG_holder_height+BL_snooker_ball_radius>, BL_snooker_ball_radius+eps } texture{ NG_holder_texture } } #declare snook_gauge_base = // A disk to serve as suport and background for a snooker ball. // The disk is centered on the Z-axis, with bottom of base disk at Z = 0. cylinder{ <0,0,0+eps>, <0,0,NG_base_height-eps>, NG_base_radius - eps texture{ NG_base_texture } } #macro snook_gauge_on_base(bas_dx,bas_dy) // Snooker-ball light direction gauge on a contrasting base. // The ball is centered on the Z axis with bottom at Z={NG_base_height}. // The base is centered over {(bas_dx,bas_dy)} with bottom at Z=0. #local r = NG_holder_radius; #local h = NG_holder_height; #local b = NG_base_height; #local R = BL_snooker_ball_radius; union{ object{ snook_gauge_base translate } object{ snook_gauge_holder translate b*z } object{ snooker_ball_black translate (b+h+R)*z } } #end