home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / p / ply15dat.zip / POLYTOPE.PI < prev    next >
Text File  |  1992-10-26  |  6KB  |  201 lines

  1. //
  2. // Polyray data file by Alexander Enzmann
  3. // 4 February 1992
  4. //
  5. // A number of polytopes (including the 5 regular polyhedra):
  6. //   tetrahedron, cube, octahedron, dodecahedron, icosahedron,
  7. //   stella_octangula, compound_cubocta, compound_dodecicos,
  8. //   cuboctahedron, and icosidodecahedron.
  9. //
  10. // Each of the 5 platonic solids has been scaled so that it exactly
  11. // fits into a sphere of radius 1.
  12. //  
  13.  
  14. viewpoint {
  15.    from  <0,0,-12>
  16.    at    <0,0,0>
  17.    up    <0,1,0>
  18.    angle 45
  19.    resolution 512, 512
  20.    }
  21.  
  22. background midnight_blue
  23. light < 20,30,-20>
  24. light <-20,30,-20>
  25.  
  26. include "..\colors.inc"
  27.  
  28. define  tau 1.6180339887 // Golden mean = (1 + sqrt(5))/2
  29. define itau 0.6180339888 // tau^-1
  30.  
  31. // dist to vertex = 1.73073
  32. define tetrahedron
  33. object {
  34.      object { polynomial  x + y + z - 1 }
  35.    * object { polynomial  x - y - z - 1 }
  36.    * object { polynomial -x + y - z - 1 }
  37.    * object { polynomial -x - y + z - 1 }
  38.    scale <1/1.73073, 1/1.73073, 1/1.73073>
  39.    bounding_box <-1, -1, -1>, <1, 1, 1>
  40.    }
  41.  
  42. // dist to a vertex = 1.73205
  43. define cube
  44. object {
  45.      object { polynomial  x - 1 }
  46.    * object { polynomial  y - 1 }
  47.    * object { polynomial  z - 1 }
  48.    * object { polynomial -x - 1 }
  49.    * object { polynomial -y - 1 }
  50.    * object { polynomial -z - 1 }
  51.    scale <1/1.73205, 1/1.73205, 1/1.73205>
  52.    bounding_box <-1, -1, -1>, <1, 1, 1>
  53.    }
  54.  
  55. // dist to vertex = 1
  56. define octahedron
  57. object {
  58.      object { polynomial  x + y + z - 1 }
  59.    * object { polynomial  x + y - z - 1 }
  60.    * object { polynomial  x - y + z - 1 }
  61.    * object { polynomial  x - y - z - 1 }
  62.    * object { polynomial -x + y + z - 1 }
  63.    * object { polynomial -x + y - z - 1 }
  64.    * object { polynomial -x - y + z - 1 }
  65.    * object { polynomial -x - y - z - 1 }
  66.    bounding_box <-1, -1, -1>, <1, 1, 1>
  67.    }
  68.  
  69. // dist to vertex = 0.66158
  70. define dodecahedron
  71. object {
  72.      object { polynomial  z + tau * y - 1 }
  73.    * object { polynomial  z - tau * y - 1 }
  74.    * object { polynomial -z + tau * y - 1 }
  75.    * object { polynomial -z - tau * y - 1 }
  76.    * object { polynomial  x + tau * z - 1 }
  77.    * object { polynomial  x - tau * z - 1 }
  78.    * object { polynomial -x + tau * z - 1 }
  79.    * object { polynomial -x - tau * z - 1 }
  80.    * object { polynomial  y + tau * x - 1 }
  81.    * object { polynomial  y - tau * x - 1 }
  82.    * object { polynomial -y + tau * x - 1 }
  83.    * object { polynomial -y - tau * x - 1 }
  84.    scale <1/0.66158, 1/0.66158, 1/0.66158>
  85.    bounding_box <-1, -1, -1>, <1, 1, 1>
  86.    }
  87.  
  88. // Icosahedron, dist from center to a vertex = 0.72654
  89. define icosahedron
  90. object {
  91.      object { polynomial  x + y + z - 1 }
  92.    * object { polynomial  x + y - z - 1 }
  93.    * object { polynomial  x - y + z - 1 }
  94.    * object { polynomial  x - y - z - 1 }
  95.    * object { polynomial -x + y + z - 1 }
  96.    * object { polynomial -x + y - z - 1 }
  97.    * object { polynomial -x - y + z - 1 }
  98.    * object { polynomial -x - y - z - 1 }
  99.    * object { polynomial  itau * y + tau * z - 1 }
  100.    * object { polynomial  itau * y - tau * z - 1 }
  101.    * object { polynomial -itau * y + tau * z - 1 }
  102.    * object { polynomial -itau * y - tau * z - 1 }
  103.    * object { polynomial  itau * z + tau * x - 1 }
  104.    * object { polynomial  itau * z - tau * x - 1 }
  105.    * object { polynomial -itau * z + tau * x - 1 }
  106.    * object { polynomial -itau * z - tau * x - 1 }
  107.    * object { polynomial  itau * x + tau * y - 1 }
  108.    * object { polynomial  itau * x - tau * y - 1 }
  109.    * object { polynomial -itau * x + tau * y - 1 }
  110.    * object { polynomial -itau * x - tau * y - 1 }
  111.    scale <1/0.72654, 1/0.72654, 1/0.72654>
  112.    bounding_box <-1, -1, -1>, <1, 1, 1>
  113.    }
  114.  
  115. // Simplest compound figure, two tetrahedrons
  116. define stella_octangula
  117. object {
  118.     tetrahedron
  119.   + tetrahedron { rotate <180, 90, 0> }
  120.   }
  121.  
  122. // Compound figure made out of cube and octahedron
  123. define compound_cubocta
  124. object {
  125.    cube + octahedron { scale <1.1547, 1.1547, 1.1547> }
  126.    }
  127.  
  128. // Compound figure made out of dodecahedron and icosahedron
  129. define compound_dodecicos
  130. object {
  131.    dodecahedron + icosahedron { scale <1.0982, 1.0982, 1.0982> }
  132.    }
  133.  
  134. // The two quasi-regular polytopes
  135. define cuboctahedron
  136. object {
  137.    cube * octahedron { scale <1.1547, 1.1547, 1.1547> }
  138.    }
  139.  
  140. define icosidodecahedron
  141. object {
  142.    dodecahedron * icosahedron { scale <1.0982, 1.0982, 1.0982> }
  143.    }
  144.  
  145. // Place the various polytopes in a circles around
  146. // a sphere
  147. define red_tex matte_red
  148. define green_tex matte_green
  149.  
  150. tetrahedron {
  151.    rotate <15, 15, 0>
  152.    translate <2, 0, 2>
  153.    red_tex
  154.    }
  155. cube {
  156.    rotate <15, 15, 0>
  157.    translate <2*cos(radians(72)),   2*sin(radians(72)), 2>
  158.    red_tex
  159.    }
  160. octahedron {
  161.    rotate <15, 15, 0>
  162.    translate <2*cos(radians(144)),  2*sin(radians(144)), 2>
  163.    red_tex
  164.    }
  165. dodecahedron {
  166.    rotate <15, 15, 0>
  167.    translate <2*cos(radians(-144)), 2*sin(radians(-144)), 2>
  168.    red_tex
  169.    }
  170. icosahedron {
  171.    rotate <15, 15, 0>
  172.    translate <2*cos(radians(-72)),  2*sin(radians(-72)), 2>
  173.    red_tex
  174.    }
  175.  
  176. stella_octangula {
  177.    rotate <15, 15, 0>
  178.    translate <3*cos(radians(36)),   3*sin(radians(36)), 0>
  179.    green_tex
  180.    }
  181. compound_cubocta {
  182.    rotate <15, 15, 0>
  183.    translate <3*cos(radians(108)),  3*sin(radians(108)), 0>
  184.    green_tex
  185.    }
  186. compound_dodecicos {
  187.    rotate <15, 15, 0>
  188.    translate <3*cos(radians(180)),  3*sin(radians(180)), 0>
  189.    green_tex
  190.    }
  191. cuboctahedron {
  192.    rotate <15, 15, 0>
  193.    translate <3*cos(radians(-108)), 3*sin(radians(-108)), 0>
  194.    green_tex
  195.    }
  196. icosidodecahedron {
  197.    rotate <15, 15, 0>
  198.    translate <3*cos(radians(-36)),  3*sin(radians(-36)), 0>
  199.    green_tex
  200.    }
  201.