home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / varia / povray3 / povray3_fpu / misc / hand.pov < prev   
Text File  |  1997-12-12  |  5KB  |  189 lines

  1. #include "colors.inc"
  2. #include "textures.inc"
  3. #include "shapes.inc"
  4. #include "color.inc"
  5.  
  6. #global_settings {
  7.   assumed_gamma 2.2
  8. }
  9.  
  10. // Hand adapted from Alfonso Hermida's "Adventures in Ray Tracing"
  11. //===============================================================
  12. #declare FingerAnglex123 = -30
  13. #declare FingerAnglex23  = -30
  14. #declare FingerAnglex3   = -30
  15.  
  16. #declare ThumbAngley     =  -10
  17. #declare ThumbAnglez     =  75
  18. #declare ThumbAngle2x    =  0
  19.  
  20. #declare Finger_Diam = 0.3
  21. #declare Finger_Section_Len = 0.4
  22. #declare FG = 0.15
  23.  
  24. #declare Palm = union {
  25.     box { <-1, -1, -1>, <1, 1, 1> }
  26.     cylinder { <-1, 1, 0> <1, 1, 0>, 0.25 scale <1, 1, 4> }
  27.     scale <1.35, 1.5, 0.3> 
  28. }
  29. #declare Knuckle = object { sphere {<0,0,0>,1.0}
  30.     scale <Finger_Diam, Finger_Diam, Finger_Diam>
  31.     translate -y*Finger_Section_Len
  32. }
  33. #declare Finger_Section = cylinder { <0,-1,0>, <0,1,0>, 1
  34.     scale <Finger_Diam, Finger_Section_Len, Finger_Diam>
  35. }
  36. #declare Finger_With_Knuckle = union {
  37.     object { Finger_Section }
  38.     object { Knuckle }
  39. }
  40. #declare Finger_Lower_Section = object {
  41.     Finger_With_Knuckle
  42. }
  43. #declare Finger_Mid_Section = object {
  44.     Finger_With_Knuckle
  45. }
  46. #declare Finger_Tip_Section = union {
  47.     object { Finger_With_Knuckle }
  48.     object { Knuckle translate y*Finger_Section_Len*2 }       // Finger tip
  49. }
  50.  
  51. #declare Thumb = union {
  52.     object { Finger_Tip_Section  } // Connected to hand
  53.     object { Finger_Tip_Section    // Tip
  54.         translate y * Finger_Section_Len
  55.         rotate x * ThumbAngle2x
  56.         translate y * Finger_Section_Len * 2
  57.     }
  58.     rotate z * ThumbAnglez
  59.     rotate y * ThumbAngley
  60.     translate -x * 1.75
  61. }
  62.  
  63. #declare Finger = union {
  64.     object { 
  65.         Finger_Lower_Section 
  66.         translate y * Finger_Section_Len
  67.     }
  68.     union {
  69.         object { Finger_Mid_Section 
  70.             translate y * Finger_Section_Len
  71.         }
  72.         object { Finger_Tip_Section 
  73.             translate y * Finger_Section_Len
  74.             rotate x * FingerAnglex3
  75.             translate y * Finger_Section_Len * 2
  76.         }
  77.     rotate x * FingerAnglex23
  78.     translate y * Finger_Section_Len * 2
  79.     }
  80.     rotate x * FingerAnglex123
  81. }
  82.  
  83. #declare Finger1 = object { 
  84.     Finger
  85.     scale <0.9, 0.8, 1>
  86.     translate <2*(Finger_Diam+(2*FG)), 1.75, 0>
  87. }
  88. #declare Finger2 = object { 
  89.     Finger
  90.     scale <0.9, 1.0, 1>
  91.     translate <Finger_Diam+FG, 1.75, 0>
  92. }
  93. #declare Finger3 = object { 
  94.     Finger
  95.     scale <0.9, 0.9, 1>
  96.     translate <-(Finger_Diam+FG), 1.75, 0>
  97. }
  98. #declare Finger4 = object { 
  99.     Finger
  100.     scale <0.9, 0.75, 1>
  101.     translate <-2*(Finger_Diam+(2*FG)), 1.75, 0>
  102. }
  103.  
  104. #declare Hand = union {   
  105.   object { Palm }
  106.   object { Thumb }
  107.   object { Finger1 }
  108.   object { Finger2 }
  109.   object { Finger3 }
  110.   object { Finger4 }
  111.   texture {
  112.     Silver1
  113.     finish { reflection 0 }
  114.   }
  115. }
  116.  
  117. // The axis bar and rotation pointer definitions
  118. //=======================================================================
  119.  
  120. // The axis bar
  121. //-------------
  122. #declare Axis_Bar = union {
  123.     object { Disk_X scale <6, 1, 1> }
  124.     object { Cone_X scale <1, 1.5, 1.5> translate x * 7 }
  125.     texture {
  126.         Silver1
  127.         pigment { Red }
  128.         finish { reflection 0 }
  129.     }
  130.     scale <1, 0.35, 0.35> 
  131.     translate <-4, 0.35, 1.65> 
  132. }
  133.  
  134. // Rotation Pointer 
  135. //----------------
  136. #declare Cone = cone { <0,0,0>, 0  <0,0,1>, 1
  137.     scale <0.05, 0.05, 0.15>
  138.     rotate <90, 0, 0>
  139.    translate <0.3, 0.15, 0>
  140. }
  141.  
  142. #declare Torus = torus { 
  143.     0.30, 0.015  sturm
  144.     rotate -x*90
  145. }
  146.  
  147. #declare Cube = box { <-1, -1, -1>, <1, 1, 1>
  148.     scale <0.2, 0.2, 0.2>
  149.     translate <0.2, 0.2, 0>
  150.     inverse
  151. }
  152.  
  153. #declare Torus_Segment = object { Torus 
  154.     clipped_by { object { Cube } }
  155. }
  156.  
  157. #declare Rotation_Pointer = union {
  158.     object { Cone }
  159.     object { Torus_Segment }
  160.     texture { Silver1
  161.         pigment { Yellow }
  162.         finish { reflection 0 }
  163.     }
  164.     scale 7
  165.     rotate <190, -90, 0>
  166.     rotate -x*120
  167.     translate <-4.0, 0.35, 1.65> 
  168. }
  169.  
  170.  
  171. //=====================================================================
  172. camera { 
  173.   location  <4, 5, -6>
  174.   direction z*1.45
  175.   right x*4/3
  176.   look_at <0.5, 1.5, 0>
  177. }
  178.  
  179. light_source { <10, 10, -10> color White }
  180. light_source { <-100, 100, -100> color LightSteelBlue }
  181.  
  182. object { Hand rotate y*180}
  183. union {
  184.     object { Axis_Bar }
  185.     object { Rotation_Pointer }
  186.     translate z*0.2
  187. }
  188.  
  189.