home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / graphics / ftpovst / libs / shapesv2.inc < prev    next >
Text File  |  1993-12-01  |  5KB  |  228 lines

  1. // Persistence Of Vision Raytracer 
  2. // Standard shapes include file.
  3.  
  4. /*
  5.  
  6.   NOTE:  Some of these shapes, in particular, the "Disk_?" group, have
  7.   been changed in such a way that they will not work correctly with some of
  8.   the old scene files.  The file "shapes.old" is also included in this package
  9.   for exactly this purpose.  The reason for this change was to provide a set
  10.   of shapes that would scale in a consistant fashion.  We apologize for
  11.   any inconvenience that this may cause in the short term, but expect
  12.   that you'll quickly come to agree that this is easier to learn and to
  13.   use.
  14.  
  15.   The quadric Sphere has been duplicated under the preferred name of
  16.   Ellipsoid to differentiate it from the internal sphere primitive.  Please
  17.   refer to Ellipsoid when you wish to use a quadric sphere.
  18.  
  19.  
  20.   Revised shapes.inc
  21.   All primitives scale the same as a sphere with radius=1.
  22.   Changes:
  23.       Disk_X (was X_Disk)
  24.       Disk_Y (was Y_Disk)
  25.       Disk_Z (was Z_Disk)
  26.       QCone_X (was Cone_X)
  27.       QCone_Y (was Cone_Y)
  28.       QCone_Z (was Cone_Z)
  29.   New: 
  30.        UnitBox
  31.        Ellipsoid
  32.        Cone_X (now unit shape intersection instead of infinite quadric)
  33.        Cone_Y (now unit shape intersection instead of infinite quadric)
  34.        Cone_Z (now unit shape intersection instead of infinite quadric)
  35.   Moved: to shapes2.pov
  36.       Square_X
  37.       Square_Y
  38.       Square_Z
  39.       Pyramid
  40.       Tetrahedron
  41. */
  42.  
  43. #declare Ellipsoid = quadric {
  44.    <1.0 1.0 1.0>
  45.    <0.0 0.0 0.0>
  46.    <0.0 0.0 0.0>
  47.    -1.0 0.0
  48. }
  49. #declare Sphere = quadric {
  50.    <1.0 1.0 1.0>
  51.    <0.0 0.0 0.0>
  52.    <0.0 0.0 0.0>
  53.    -1.0 0.0
  54. }
  55.  
  56. #declare Cylinder_X = quadric {
  57.    <0.0 1.0 1.0>
  58.    <0.0 0.0 0.0>
  59.    <0.0 0.0 0.0>
  60.    -1.0 0.0
  61. }
  62.  
  63. #declare Cylinder_Y = quadric {
  64.    <1.0 0.0 1.0>
  65.    <0.0 0.0 0.0>
  66.    <0.0 0.0 0.0>
  67.    -1.0 0.0
  68. }
  69.  
  70. #declare Cylinder_Z = quadric {
  71.    <1.0 1.0 0.0>
  72.    <0.0 0.0 0.0>
  73.    <0.0 0.0 0.0>
  74.    -1.0 0.0
  75. }
  76.  
  77. // Infinite cones
  78. #declare QCone_X = quadric {
  79.    <-1.0 1.0 1.0>
  80.    <0.0 0.0 0.0>
  81.    <0.0 0.0 0.0>
  82.    0.0
  83. }
  84.  
  85. #declare QCone_Y = quadric {
  86.    <1.0 -1.0 1.0 0.0>
  87.    <0.0 0.0 0.0>
  88.    <0.0 0.0 0.0>
  89.    0.0
  90. }
  91.  
  92. #declare QCone_Z = quadric {
  93.    <1.0 1.0 -1.0 0.0>
  94.    <0.0 0.0 0.0>
  95.    <0.0 0.0 0.0>
  96.    0.0
  97. }
  98.  
  99.  
  100. /*
  101.  
  102. // Unit cones    
  103. //
  104. // Use: intersection { Cone_X }
  105. //
  106. #declare Cone_X = 
  107. intersection { 
  108.    quadric { QCone_X translate <0 1 0> } 
  109.    box { <-2 -1 -2 0.0>
  110.          <02 01 02> }
  111.    scale <.5 1 .5>
  112. }
  113.  
  114. #declare Cone_Y = 
  115. intersection { 
  116.    quadric { QCone_Y  translate <0 1 0>} 
  117.    box { <-2 -1 -2>
  118.           <02 01 02> }
  119.    scale <.5 1 .5>
  120. }
  121.  
  122. #declare Cone_Z = 
  123. intersection { 
  124.    quadric { QCone_Z translate <0 1 0>} 
  125.    box { <-2 -1 -2>
  126.           <02 01 02> }
  127.    scale <.5 1 .5>
  128. }
  129.  
  130. */
  131.  
  132. #declare Plane_YZ = quadric {
  133.    <0.0 0.0 0.0>
  134.    <0.0 0.0 0.0>
  135.    <1.0 0.0 0.0>
  136.    0.0
  137. }
  138.  
  139. #declare Plane_XZ = quadric {
  140.    <0.0 0.0 0.0>
  141.    <0.0 0.0 0.0>
  142.    <0.0 1.0 0.0>
  143.    0.0
  144. }
  145.  
  146. #declare Plane_XY = quadric {
  147.    <0.0 0.0 0.0>
  148.    <0.0 0.0 0.0>
  149.    <0.0 0.0 1.0>
  150.    0.0
  151. }
  152.  
  153. /* y^2 + z^2 - x = 0 */
  154. #declare Paraboloid_X = quadric {
  155.    <0.0  1.0  1.0>
  156.    <0.0  0.0  0.0>
  157.    <-1.0 0.0  0.0>
  158.    0.0
  159. }
  160.  
  161. /* x^2 + z^2 - y = 0 */
  162. #declare Paraboloid_Y = quadric {
  163.    <1.0  0.0  1.0>
  164.    <0.0  0.0  0.0>
  165.    <0.0 -1.0  0.0 0.0>
  166.    0.0
  167. }
  168.  
  169. /* x^2 + y^2 - z = 0 */
  170. #declare Paraboloid_Z = quadric {
  171.    <1.0  1.0  0.0>
  172.    <0.0  0.0  0.0>
  173.    <0.0  0.0 -1.0 0.0>
  174.    0.0
  175. }
  176.  
  177. /* y - x^2 + z^2 = 0 */
  178. #declare Hyperboloid = quadric {
  179.    < -1.0  0.0  1.0>
  180.    <  0.0  0.0  0.0>
  181.    <  0.0  1.0  0.0>
  182.    0.0
  183. }
  184.  
  185. #declare Hyperboloid_Y = quadric {  /* Vertical hyperboloid */
  186.    <1.0 -1.0  1.0 0.0>      /*                      */
  187.    <0.0  0.0  0.0>          /*            \   /     */
  188.    <0.0  0.0  0.0>          /* Like this:  ) (      */
  189.    -1.0 0.0                 /*            /   \     */
  190. }
  191.  
  192.  
  193. // Cube using the procedural box primitive
  194. #declare UnitBox = box { <-1.0 -1.0 -1.0 0.0 0.0>
  195.                     <1.0 1.0 1.0 > }
  196.  
  197. // This primitive used to be an intersection of six planes.  For speed, it's now
  198. // an intersection of a box and nothing else.
  199. #declare Cube = intersection { box { <-1 -1 -1 0.0 0.0>
  200.                         <1 1 1>} }
  201.  
  202. // The Disk primitives are "capped" cylinders of unit length.
  203. //
  204. // Note: These three shapes have been changed for Version 1.0.
  205. // They are now "unit" size, the same as a sphere with a radius of 1.
  206. // They will now scale evenly in all directions.
  207. // Old files may need to be modified to work with these shapes, but
  208. // I think you'll find them to be more consistant with the rest of the
  209. // POV-Ray primitives and easier for novices to understand.
  210.  
  211. #declare Disk_X = intersection {       /* Capped cylinder, Length in x axis */
  212.    quadric { Cylinder_X  }
  213.    plane { <1.0 0.0 0.0> -1 0.0 }
  214.    plane { <1.0 0.0 0.0>  1  }
  215. }
  216.  
  217. #declare Disk_Y = intersection {       /* Capped cylinder, Length in y axis */
  218.    quadric { Cylinder_Y  }
  219.    plane { <0.0 1.0 0.0> -1 0.0 }
  220.    plane { <0.0 1.0 0.0>  1 }
  221. }
  222.  
  223. #declare Disk_Z = intersection {       /* Capped cylinder, Length in z axis */
  224.    quadric { Cylinder_Z  }
  225.    plane { <0.0 0.0 1.0> -1 0.0  }
  226.    plane { <0.0 0.0 1.0>  1  }
  227. }
  228.