home *** CD-ROM | disk | FTP | other *** search
/ Ray Tracing Box / RAY_CD.mdf / raytrace / _pov_dat / spark / spark.inc < prev    next >
Text File  |  1993-03-15  |  7KB  |  259 lines

  1. /*
  2.  *  SPARK.INC
  3.  *
  4.  *  Spark plug, centered on <0 0 0>, and contained in the space
  5.  *  from <-1.73 -0.39 -0.48> to <1.33 0.39 0.48 >, aligned along the X axis,
  6.  *  with the spark end at +X, the terminal end at -X.
  7.  *
  8.  *  This file REQUIRES the following include files:
  9.  *
  10.  *  COLORS.INC       POVRAY file
  11.  *  SHAPES.INC          "
  12.  *  TEXTURES.INC        "
  13.  *  
  14.  *  RIBCYL.INC       included with this file
  15.  *
  16.  *  RN9YC.GIF           "
  17.  *  MADEIN.GIF          "
  18.  *
  19.  *  Note:  this object requires LOTS of memory.  I set the Region
  20.  *         setting with POVMOD.EXE to 8M.
  21.  *
  22.  *  John Lowery
  23.  *  71075, 1401
  24.  */
  25.  
  26. #declare Spark_Plug = composite {
  27. // The connector (two metallic r=.125 blobbies spaced d=.125, and a disk
  28. object {
  29.    intersection {
  30.       blob {
  31.          threshold 0.4
  32.          component 1.0 0.18 <-1.67 0 0>
  33.          component 1.0 0.18 <-1.47 0 0>
  34.          sturm
  35.       }
  36.       plane { <1.0 0.0 0.0>  -1.73 inverse }
  37.    }
  38.    texture { Silver_Metal }
  39. }
  40.  
  41. object {
  42.    intersection { Disk_X
  43.       scale <.03 .156 .156>
  44.       translate <-1.42 0 0>
  45.    }
  46.    texture { Silver_Metal }
  47. }
  48.  
  49. // The insulator body
  50.  
  51. object {
  52.                                  // clip off 1/4 of the first rib
  53.    intersection
  54.    {
  55.       union { TwoRibSection }  
  56.       plane { <1.0 0.0 0.0> -0.35 inverse  }
  57.    }
  58.    bounded_by { box {<-0.5 -1 -1><0.5 1 1>} }
  59.    texture { Glossy  color White }
  60.    scale <.188 .23 .23>       // scale rib section to .188 len, .23 radius
  61.                               // note: rib inside radius is 0.869, scales
  62.                               //       to 0.220, the same as the next cyl.
  63.    translate <-1.314 0 0>
  64. }
  65.  
  66. object {
  67.    intersection { Disk_Y }
  68.    texture { 
  69.       Glossy 
  70.       image_map { 2 gif "rn9yc.gif" once interpolate 2 } 
  71.       translate < 0 -.5 0 >     // center image map on zero in Y
  72.       scale < 1 2 1 >           // scale it to cover length == 2
  73.    }
  74.    rotate < 0 0 90 >        // make it a cylinder in X
  75.    scale <.125 .22 .22>     // scale disk to .250 len, .22 radius
  76.    translate <-1.095 0 0>
  77. }
  78.  
  79. object {
  80.    intersection {                   // clip off 1/4 of the first rib 
  81.       union { FourRibSection }      // each rib is .25 unit long 
  82.       plane { <1.0 0.0 0.0> -0.45 inverse  }
  83.    }
  84.    bounded_by { box {<-0.5 -1.0 -1.0><0.5 1.0 1.0>} }
  85.    texture { Glossy  color White }
  86.    scale <.375 .25 .25>       // 2"dia x 1"len -> .5"dia x .375 len
  87.    translate <-0.83 0 0>
  88. }
  89.  
  90. object { 
  91.    intersection { Disk_X
  92.       scale <.10 .25 .25>     // 2"dia x 2"len -> .5"dia x .2"len
  93.       translate <-.56 0 0>
  94.    }
  95.    texture { Glossy
  96.       color White
  97.    }
  98. }
  99.  
  100. // The rounded junction between the insulator body and the hex nut
  101. // ( one end of a small sphere )
  102. object {
  103.    intersection {
  104.       sphere { < -0.125 0.0 0.0> .4375 }
  105.       plane { <1.0 0.0 0.0>  -0.250  }
  106.    }
  107.    texture { Silver_Metal }
  108. }
  109.  
  110. // The hex nut 
  111. // ( hex nut - a disk, cut by six planes
  112. object { 
  113.    intersection { 
  114.       quadric { Cylinder_X  }
  115.  
  116.       // the ends
  117.       plane { <1.0 0.0 0.0> -1 inverse  }
  118.       plane { <1.0 0.0 0.0>  1  }
  119.  
  120.       // the sides
  121.       plane { <0.0 1.0 0.0>  -0.90 inverse } 
  122.       plane { <0.0 1.0 0.0>  0.90  }
  123.  
  124.       plane { <0.0 -0.500 0.867>  -0.90 inverse } 
  125.       plane { <0.0 -0.500 0.867>  0.90  }
  126.  
  127.       plane { <0.0 0.500 0.867>  -0.90 inverse } 
  128.       plane { <0.0 0.500 0.867>  0.90  }
  129.  
  130.       scale <.11 .48 .48>
  131.       translate <-0.25 0 0>
  132.    }
  133.    texture { Silver_Metal }
  134. }
  135.  
  136. // A metallic cylinder
  137. object { 
  138.    intersection { Disk_Y }
  139.    texture {  
  140.       Silver_Metal
  141.       bump_map { 2 gif "madein.gif" bump_size -100 once interpolate 2.0 }
  142.       translate < 0 -.75 0 >     // center bitmap on cylinder
  143.       scale < 1 1.25 1 >           // make it cover length == 
  144.    }
  145.    rotate < 0 0 90 >        // make it a cylinder in X
  146.    scale <.38 .41 .41>
  147.    translate <0 0 0>
  148. }
  149.  
  150. // A metallic cylinder
  151. //object { intersection { Disk_X
  152. //      scale <.38 .41 .41>
  153. //      translate <0 0 0>
  154. //   }
  155. //   texture { Silver_Metal }
  156. //}
  157.  
  158. // The threaded cylinder
  159. object { 
  160.    difference {
  161.       union {
  162.          union { FourThreadSection 
  163.             scale <.1145 .27 .27>   // 2 long, 2 dia => .229 long, .54 dia 
  164.             translate <.442 0 0> 
  165.          }
  166.          union { FourThreadSection
  167.             scale <.1145 .27 .27>   // 2 long, 2 dia => .229 long, .54 dia 
  168.             translate <.671 0 0> 
  169.          }
  170.          union { FourThreadSection
  171.             scale <.1145 .27 .27>   // 2 long, 2 dia => .229 long, .54 dia 
  172.             translate <.900 0 0> 
  173.          }
  174.          intersection { Disk_X 
  175.             scale <.05 .22 .22> 
  176.             translate <1.03 0 0> 
  177.          }
  178.       }
  179.       quadric { Cylinder_X 
  180.          scale <1.0 .16 .16> 
  181.          translate <0 0 0> 
  182.       }
  183.    }  // end difference
  184.  
  185.    texture { Silver_Metal }
  186.  
  187.    bounded_by { 
  188.       intersection { Disk_X  scale <0.5 0.28 0.28> translate <0.8125 0 0> } 
  189.    }
  190. }
  191.  
  192. // The copper washer
  193. object { 
  194.    difference {
  195.       intersection { Disk_X
  196.          scale <.03 .41 .41>
  197.          translate <.44 0 0>
  198.       }
  199.       quadric { Cylinder_X 
  200.          scale <1.0 .30 .30> 
  201.          translate <0 0 0> 
  202.       }
  203.    }
  204.    texture { Copper_Texture }
  205. }
  206.  
  207. // The center terminal insulator
  208. object {
  209.    intersection { 
  210.       quadric { QCone_X } 
  211.  
  212.       // clips cone at r=0.09 and r=0.13
  213.       box { <-.13 -0.15 -0.15> <-.09 0.15 0.15> }  
  214.       scale <25 1 1>        // stretch the .04 cone segment to 1
  215.     translate <3.4 0 0 > // translate from tip at x=-2.25 to x=1.19
  216.    }
  217.    texture { Dull
  218.       color White
  219.    }
  220. }
  221.  
  222. // The center terminal
  223. object {
  224.    intersection { Disk_X
  225.       scale < .13 .05 .05 >
  226.       translate < 1.1 0 0 >
  227.    }
  228.    texture { Silver_Metal }
  229. }
  230.  
  231. // The ground terminal
  232. object {
  233.    union {
  234.       box {<0.13 0 -0.06> <0.18 0.08 0.06>}
  235.       box {<-.08 -0.18 -0.06> <0 -0.13 0.06>}
  236.       intersection {
  237.          difference {
  238.             intersection { Disk_Z  scale< .18 .18 .06>}
  239.             quadric { Cylinder_Z  scale< .13 .13 1>}
  240.          }
  241.          box { <0 -0.5 -.1> < 1 0 .1> }
  242.       }  // end intersection
  243.    }     // end union
  244.  
  245.    translate < 1.15 -0.03 0>
  246.    texture { Silver_Metal }
  247. }
  248.  
  249. // A spark.  The center terminal ends at x=1.23, ground terminal begins
  250. //           at x=1.28.  The spark touches both.
  251. //object { light_source { <1.25 0 0> color red 0.9 green 0.9 blue 1.0 }}
  252. //object { 
  253. //    sphere { <1.25 0 0> 0.06 }
  254. //    texture { Dull color White alpha 0.8 }
  255. //}
  256.  
  257. } // end composite Spark_Plug 
  258.  
  259.