/******************************************************************** * CAPACITORS include file for the Persistance of Vision Ray Tracer * * part of the ELECTRONICS set * ******************************************************************** * * Created by Mark Hanford, December 2001 * * * Base units: millimetres * Height - 14.5mm * Radius - 4.1mm *********************************************************************/ /******************************************** * Check for and set some default variables * ********************************************/ #ifdef(View_POV_Include_Stack) #debug "including capacitors.inc\n" #end #ifdef (MH_Capacitors_Inc_Temp) //do nothing #else #declare MH_Capacitors_Inc_Temp=1; #include "electronics.inc" /************* * Constants * *************/ #declare CapacitorHeight = 14.5; #declare CapacitorRadius = 8.2/2; /************ * Textures * ************/ #declare T_CapacitorTop = texture{pigment{color red 0.90 green 0.91 blue 0.98} finish{phong 1}} #declare T_CapacitorBase = texture{pigment{color red 0.30 green 0.30 blue 0.30} finish{phong 1}} //#declare T_Capacitor = texture{pigment{color red 0.45 green 0.45 blue 0.77} finish{phong 1} normal{bumps 0.1 scale 0.1}} #declare T_Capacitor= texture{ pigment{color red 0.45 green 0.45 blue 0.77} finish{ phong 1 diffuse 0.6 // amount [0.6] brilliance 1.0 // tightness of diffuse illumination [1.0] specular 0.5 // amount [0.0] roughness 0.05 // (~1.0..0.0005) (dull->highly polished) [0.05] } normal{bumps 0.1 scale 0.1} } texture{ pigment{ image_map{ gif "images/cap_elec_470u.gif" transmit 144, 1 map_type 2 interpolate 4 once } scale <1, 17, 1> translate -1*y rotate 40*y } } // this is the actual capacitor // ---------------------------- #macro CapacitorElectrolytic() #local TopNotchDepth = 0.1; #local TopNotchRadius = 5/2; #local BottomNotchRadius = 4.6/2; union{ difference{ superellipsoid{ <1.0, 0.1> rotate 90*x scale translate (CapacitorHeight/2)*y } cylinder{<0, CapacitorHeight-1, 0>, <0, CapacitorHeight+1, 0>, TopNotchRadius} //this makes the hole in the top of the plastic cylinder{<0, CapacitorHeight-1, 0>, <0, CapacitorHeight-0.1, 0>, CapacitorRadius*0.9} //this makes the plastic thin at the top cylinder{<0, -1.0, 0>, <0, 1, 0>, BottomNotchRadius} //this makes the hole in the bottom of the plastic cylinder{<0, 0.1, 0>, <0, 1, 0>, CapacitorRadius*0.9} //this makes the plastic thin at the bottom torus{CapacitorRadius*2, CapacitorRadius*1.03 translate 2.5*y} //takes out the 'waist' near the bottom texture{T_Capacitor} } cylinder{<0, 0.2, 0>, <0, 1, 0>, CapacitorRadius*0.9 texture{T_CapacitorBase}} //the bottom inner plastic bit difference{ cylinder{<0, CapacitorHeight-1, 0>, <0, CapacitorHeight-0.15, 0>, CapacitorRadius*0.9} //the top inner metal bit cylinder{<0, CapacitorHeight-0.15, 0>, <0, CapacitorHeight-0.15, -CapacitorRadius*0.91>, TopNotchDepth rotate 0*y} //the three top notches (1) cylinder{<0, CapacitorHeight-0.15, 0>, <0, CapacitorHeight-0.15, -CapacitorRadius*0.91>, TopNotchDepth rotate 120*y} //the three top notches (2) cylinder{<0, CapacitorHeight-0.15, 0>, <0, CapacitorHeight-0.15, -CapacitorRadius*0.91>, TopNotchDepth rotate 240*y} //the three top notches (3) sphere {<0, CapacitorHeight-0.15, 0>, TopNotchDepth} //a little more out of the top to stop CSG interference texture{T_CapacitorTop} } } #end /*********************** * the selection macro * ***********************/ #macro Capacitor(CapType, Style, Depth) // Type 1 - Electrolytic // Style 1 - vertical // Style 2 - horizontal #switch (CapType) #case (1) #local SelectedCapacitor = CapacitorElectrolytic() #break #end #switch (Style) #case (1) union{ object{SelectedCapacitor} object{WireParallel(1*HolePitch, Depth+0.2) rotate -90*y translate 0.2*y} translate 0.5*HolePitch*z } #break #case (2) union{ object{SelectedCapacitor rotate <90,0,90>} object{WireParallelBent(1*HolePitch, Depth+0.2, 1*HolePitch) rotate 90*x translate 0*z} translate } #break #end #end /************* * Finish up * *************/ #end