Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "colors.inc"
  2. #declare step = 0.01;
  3. #declare xfactor = 1;
  4. #declare interval_start = 0;
  5. #declare interval_end = 1.4;
  6. #declare obj_end = 13;
  7. #declare diff = interval_end-interval_start;
  8. #declare k_interval = diff-1.4;
  9. #declare f = function(x) {(2.2*pow(x, 2)-2.66*x+5.1)*xfactor}
  10. #declare g = function(x) {(-3.5714*x+6.3)*xfactor}
  11. #declare h = function(x) {(3.7*pow(x,-0.078))*xfactor}
  12. #declare i = function(x) {(1.5*x+1.5)*xfactor}
  13. #declare j = function(x) {4.2*xfactor}
  14. #declare k = function(x) {(-2*x+9)*xfactor}
  15. #declare l = function(x) {(3*x-5)*xfactor}
  16. #declare m = function(x) {(0.12386*pow(x, 2)-1.2641*x+4.52)*xfactor}
  17. #declare n = function(x) {(1.3+sqrt(pow(0.95,2)-pow((x-6.25),2)))*xfactor}
  18. #declare o = function(x) {(sqrt(x-7.2)*1.9+1.3)*xfactor}
  19. #declare p = function(x) {(-4*pow(2, -3/4*(x-8.058))+5.862)*xfactor}  
  20. #macro cylindersInInterval(i_start, i_end, func)
  21.     #for (index, i_start, i_end-step, step)
  22.         cylinder {
  23.             <index, 0, 0>,
  24.             <index+step, 0, 0>,
  25.             func(index)  
  26.             texture { pigment{Gold} }
  27.         }  
  28.     #end
  29. #end  
  30.  
  31. background{Grey}
  32. light_source {<6.5, -17, 0>, White}
  33. camera{
  34.     location <6.5, -17, 0>
  35.     look_at<6.5, 10, 0>
  36. }
  37. box {
  38.     <0,0,0>
  39.     <1,1,1>
  40.     texture {
  41.         pigment{White}
  42.     }
  43. }
  44.  
  45. #for (index, 0, 0.56-step, step)
  46.     cylinder {
  47.         <index-k_interval, 0, 0>,
  48.         <index+step-k_interval, 0, 0>,
  49.         f(index)  
  50.         texture { pigment{Gold} }
  51.     }  
  52. #end
  53. #for (index, 0.56, 0.7-step, step)
  54.     cylinder {
  55.         <index-k_interval, 0, 0>,
  56.         <index+step-k_interval, 0, 0>,
  57.         g(index)  
  58.         texture { pigment{Gold} }
  59.     }  
  60. #end
  61. #for (index, 0.7, 1.4-step, step)
  62.     cylinder {
  63.         <index-k_interval, 0, 0>,
  64.         <index+step-k_interval, 0, 0>,
  65.         h(index)  
  66.         texture { pigment{Gold} }
  67.     }  
  68. #end
  69. #for (index, 1.4, 1.8-step, step)
  70.     cylinder {
  71.         <index-k_interval, 0, 0>,
  72.         <index+step, 0, 0>,
  73.         i(index)  
  74.         texture { pigment{Gold} }
  75.     }  
  76. #end
  77. cylindersInInterval(1.8,2.4, j)
  78. #for (index, 2.4, 2.8-step, step)
  79.     difference{
  80.         cylinder {
  81.             <index, 0, 0>,
  82.             <index+step, 0, 0>,
  83.             k(index)  
  84.             texture { pigment{Gold} }
  85.         }
  86.         cylinder {
  87.             <index-0.0001*step, 0, 0>,
  88.             <index+1.0001*step, 0, 0>,
  89.             l(index)  
  90.             texture { pigment{Gold} }
  91.  
  92.         }
  93.     }      
  94. #end
  95. cylindersInInterval(2.4,5.3, m)
  96. cylindersInInterval(5.3,7.2, n)
  97. cylindersInInterval(7.2,10.8, o)
  98. cylindersInInterval(10.8,obj_end, p)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement