home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Raytrace & Morphing / SOS-RAYTRACE.ISO / programm / raytrace / rayce27 / surfs.inc < prev    next >
Encoding:
Text File  |  1993-12-27  |  3.8 KB  |  174 lines

  1. // Algebraic surfaces for Rayce
  2. // formulas based on Xander Enzmanns shapesq.inc
  3.  
  4. // I hope the pov team doesn't mind, after all could there be a
  5. // copyright on formulas?
  6.  
  7. /*
  8.   specifically, povlegal states:
  9.  
  10.     The user is also granted the right to use the scenes files and include 
  11.     files distributed in the INCLUDE and DEMO sub-directories of the POVDOC 
  12.     archive when creating their own scenes.  Such permission does not extend to 
  13. */
  14.  
  15.  
  16.  
  17. /* Here is a quick do of a klein-bottle. It is generated with the poly
  18.    command in PoV 2.0. Be careful, it does not have a
  19.    clearly defined inside :). The formula is:
  20.  
  21.    by   
  22.     T. Nordstrand  tore@maxwell.fi.uib.no or nfytn@alf.uib.gno
  23. */
  24.  
  25. /* Looks like a mushroom according to me, and doesn't look like the
  26.    klein bottles I've seen. [HWN]
  27. */
  28.  
  29. #declare Klein_Bottle = algebraic {
  30.   $ (x^2+y^2+z^2+2*y-1)*((x^2+y^2+z^2-2*y-1)^2-8*z^2)+
  31.     16*z*(x^2+y^2+z^2-2*y-1) $
  32. }
  33.  
  34. /*
  35.  */
  36. #declare Bicorn = algebraic { 
  37.   $ y^2 - (x^2 + z^2) * y^2 - (x^2 + z^2 + 2 *y - 1)^2 $
  38. }
  39.  
  40. #declare Crossed_Trough = algebraic { $ y = x^2* z^2 $ }
  41.  
  42. /* Looks like a drop falling up. (To the left, in the standard camera
  43.    model.) */
  44. #declare Cubic_Cylinder = algebraic {
  45.   $ y^2 + z^2 = 0.5*(x^3 + x^2) $
  46. }
  47.  
  48. /*
  49.    Haven't figured out this weird form, but it seems to render correctly. 
  50.    [HWN]
  51. */
  52. #declare Cubic_Saddle = algebraic { 
  53.   $ z = x^3 - y^3 $
  54. }
  55.  
  56. /*
  57.   two opposite cones joined by two small tubes.  
  58.  */
  59. #declare Devils_Curve = algebraic { 
  60.    $ x^4 + 2 * x^2 * z^2 - 0.36 * x^2 - y^4 + 0.25 * y^2 + z^4  $
  61. }
  62.  
  63. /*
  64.   Hmm.. not quite.
  65.  */
  66. #declare Folium = algebraic {
  67.   $ 2 * x^2 - 3 * x * y^2 - 3* x *z^2 + y^2 + z^2  $
  68. }
  69.  
  70.  
  71. /* sort of tear drop. 
  72.  */
  73. #declare Glob_5 = algebraic { 
  74.   $ y^2 + z^2 = 0.5 * x^5 + 0.5* x^4 $
  75. }
  76.  
  77. /*
  78.   a helix, not yet tested with new clipshapes.
  79.  */
  80.  
  81. #declare Helix = object{
  82.   algebraic { $ - 0.16667 * x * z^3 + x * z + 0.5 * y * z^2 - y  $ }
  83.  
  84.   clipped_by {
  85.      plane { <-1,0,0>, 1.4142 }
  86.      plane { <1,0,0>, 1.4142}
  87.   }
  88. }
  89.  
  90. /*
  91.    Bluhh.
  92.  */
  93. #declare Hyperbolic_Torus = algebraic { 
  94.   $ x^4 + 2* x^2* y^2 - 2* x^2* z^2 - 104 *x^2 + y^4 - 2 *y^2* z^2 +
  95.      56* y^2 + z^4 + 104* z^2 + 784 $
  96. }
  97.  
  98. // Lemniscate of Gerono. (ok)
  99. // sort of hourglass.
  100. #declare Gerono_Lemniscate = algebraic { 
  101.   $ x^4 - x^2 + y^2 + z^2 $ closed
  102. }
  103.  
  104. /* 
  105.    I don't know what it's supposed to be, but it suffers from huge
  106.    numerical inaccuracies. I'm feeling consolated by the fact the PoV
  107.    messes up too.
  108.  
  109.     :
  110.  
  111.    after having fixed bug...
  112.    Hah! Rayce renders it correctly, without sturm sequences!
  113. */
  114. #declare Monkey_Saddle= algebraic { 
  115.   $ z = (x^3 - 3 * x * y^2) $
  116. }
  117.  
  118. /*
  119.   not yet.
  120. */
  121. #declare Parabolic_Torus = algebraic { 
  122.   $ x^4 + 2* x^2* y^2 - 2 *x^2 *z - 104 *x^2 + y^4 - 2* y^2* z + 
  123.      56 *y^2 + z^2 + 104 *z + 784 $
  124. }
  125.  
  126. // A sort of drop that needs a diet :)
  127. // The demo in PoV gave dirty shit.
  128. #declare Piriform = algebraic { 
  129.   $ (x^4 - x^3) + y^2 + z^2  $ closed
  130. }
  131.  
  132. #declare Roll_Mill4 =algebraic {
  133.   $ x^4 - 6* x^2* y^2 + 6* y^4 = 1$ 
  134. }
  135.  
  136. /* 
  137.    a cube with rounded corners. 
  138.    element of a class of shapes described by
  139.   
  140.      || X ||_p = 1  (p >= 1) X in R^n 
  141.  
  142.    || . ||_p is the p-norm defined by
  143.  
  144.      (|x_1|^p + |x_2|^p + ... + |x_n|^p)^(1/p) = 1
  145.     
  146.    In this case (n = 3 so we get 3-d real space )
  147.  
  148.      (|x|^p + |y|^p + |z|^p)^(1/p) = 1
  149.    
  150.    since 1^p = 1, this is equivalent to
  151.  
  152.      |x|^p + |y|^p + |z|^p = 1
  153.  
  154.   
  155.    if p-> inf. then this forms a cube, faces parallel to the axes
  156.  
  157.    if p = 1, it's a cube with corners in <0,0,1>, <1,0,0>, <-1,0,0>
  158.    etc.
  159.  
  160.    if p = 2, it's a sphere. This is the shape for p = 4.
  161.  
  162. */
  163.  
  164. #declare Hyper_Quadric4 = algebraic {
  165.   $ x^4 + y^4 + z^4 = 1 $ closed
  166. }
  167.  
  168. /*
  169.    The original reason behind Art (Vort's raytracer)
  170.  */
  171. #declare Hunt_Surface = algebraic { 
  172.   $ 4 * (x^2 + y^2 + z^2 - 13)^3 + 27* (3*x^2 + y^2 -4*z^2 - 12)^2 $
  173. }
  174.