// Last edited on DATE TIME by USER
// Processed by remove-cam-lights

  

  

  

background{ color rgb < 0.75, 0.80, 0.85 > }

#declare raio = 2.000;

#declare tex_Arm = 
  texture {
    pigment { color rgb < 1.0, 1.0, 1.0 >}
        finish { diffuse 0.1 specular 0.1 roughness 0.005 ambient 0.1 reflection 0.4}
  }

#declare tex_Joint = 
  texture {
    pigment { color rgb < 2.8, 0.4, 0.4 > }
    finish { diffuse 0.1 specular 0.1 roughness 0.005 ambient 0.1 reflection 0.4}
  }

#declare tex_Fork = 
  texture {
    pigment { color rgb < 4.5, 4.5, 0.5 > }
    finish { diffuse 0.1 specular 0.1 roughness 0.005 ambient 0.1 reflection 0.5}
  }

#declare tex_Base = 
  texture {
    pigment { color rgb < 0.5, 1.5, 0.5 > }
    finish { diffuse 0.1 specular 0.1 roughness 0.005 ambient 0.1 reflection 0.5}
  }

#macro fork()

union{
  sphere{<0,0,0>20 texture{tex_Fork}}
  box{<0,-5,-10><200,5,10> texture{tex_Fork}}
  box{<200,0,-30><210,10,30> texture{tex_Fork}}
  box{<210,0,24><250,10,30> texture{tex_Fork}}
  box{<210,0,-3><250,10,3> texture{tex_Fork}}
  box{<210,0,-24><250,10,-30> texture{tex_Fork}}
}

#end

#macro base(teta_A, teta_B, gama_A, gama_B, gama_C, beta_A, beta_B, alpha_A, alpha_B, alpha_C)

 union{
  
  box{<-50,-50,-100><50,50,0> texture{tex_Base}}

  
  object{
   arm_01(gama_A, gama_B, gama_C, beta_A, beta_B, alpha_A, alpha_B, alpha_C)
   rotate<0,teta_A,teta_B>
   translate<0,0,0>
  }
 }

#end

#macro arm_01(gama_A, gama_B, gama_C, beta_A, beta_B, alpha_A, alpha_B, alpha_C)

 union{
  
  
  sphere{<0,0,0>30 texture{tex_Joint}}
  cylinder{<0,0,0>,<300,0,0>,20 texture{tex_Arm}} 

  
  object{
   arm_02(beta_A, beta_B, alpha_A, alpha_B, alpha_C)
   rotate<gama_C,gama_A,gama_B>
   translate<300,0,0>
  }
 }

#end

#macro arm_02(beta_A, beta_B, alpha_A, alpha_B, alpha_C)

 union{
  sphere{<0,0,0>30 texture{tex_Joint}}
  cylinder{<0,0,0>,<300,0,0>,20 texture{tex_Arm}}
  
  
  object{
   arm_03(alpha_A, alpha_B, alpha_C)
   rotate<0,beta_A,beta_B>
   translate<300,0,0>
  }
 }
 

#end

#macro arm_03(alpha_A, alpha_B, alpha_C)

 union{
  sphere{<0,0,0>30 texture{tex_Joint}}
  cylinder{<0,0,0>,<300,0,0>,20 texture{tex_Arm}}
  

  
  object{
   fork()
   rotate<alpha_C, alpha_A,alpha_B>
   translate<300,0,0>
  } 
 }

#end

#declare c0 = 0.0;
#declare c1 = 0.16;
#declare c2 = 0.33;
#declare c3 = 0.49;
#declare c4 = 0.66;
#declare c5 = 0.83;
#declare c6 = 1.0;

#macro quadro(clk)

#declare l_teta_A = -90;
#declare l_teta_B = 0;
#declare l_gama_A = 0;
#declare l_gama_B = 0;
#declare l_gama_C = 0;
#declare l_beta_A = 0;
#declare l_beta_B = 0;
#declare l_alpha_A = 0;
#declare l_alpha_B = 0;
#declare l_alpha_C = 0;

 union{
  
   
   
 

    
    
    #if ((clk >= c0) & (clk < c1))

    #declare rr = (clk-c0)/(c1-c0);
    #declare ss = (c1-clk)/(c1-c0);

    #declare l_gama_A = ss*0+rr*130;
    #declare l_alpha_A = ss*0+rr*-40;

   #end
   
   #if ((clk >= c1) & (clk < c2))

    #declare rr = (clk-c1)/(c2-c1);
    #declare ss = (c2-clk)/(c2-c1);

    #declare l_gama_A = ss*130+rr*30;
    #declare l_beta_A = ss*0+rr*90;
    #declare l_alpha_A = ss*-40+rr*0;
    

   #end
   
   #if ((clk >= c2) & (clk < c3))

    #declare rr = (clk-c2)/(c3-c2);
    #declare ss = (c3-clk)/(c3-c2);

    #declare l_gama_A = 30;
    #declare l_beta_A = 90;
    #declare l_alpha_A = 0;

    #declare l_gama_C = ss*0+rr*-110;

   #end
   
   #if ((clk >= c3) & (clk < c4))

    #declare rr = (clk-c3)/(c4-c3);
    #declare ss = (c4-clk)/(c4-c3);

    
    #declare l_beta_A = 90;
    #declare l_alpha_A = 0;
    #declare l_gama_C = -110;

    #declare l_gama_A = ss*30+rr*0;
   #end
   
   #if ((clk >= c4) & (clk < c5))

    #declare rr = (clk-c4)/(c5-c4);
    #declare ss = (c5-clk)/(c5-c4);

    
    
    

    #declare l_gama_A = 0;
    #declare l_beta_A = ss*90+rr*120;
    #declare l_alpha_A = ss*0+rr*-30;
    #declare l_alpha_C = ss*0+rr*90;
    #declare l_gama_C = -110;

   #end
   
   #if ((clk >= c5) & (clk <= c6))

    #declare rr = (clk-c5)/(c6-c5);
    #declare ss = (c6-clk)/(c6-c5);

    #declare l_gama_A = 0;
    #declare l_alpha_A = ss*-30+rr*0;
    #declare l_alpha_C = ss*90+rr*0;

    #declare l_beta_A = ss*120+rr*0;
    #declare l_gama_C = ss*-110+rr*0;

   #end

    object{
     base(l_teta_A, l_teta_B, l_gama_A, l_gama_B, l_gama_C, l_beta_A, l_beta_B, l_alpha_A, l_alpha_B, l_alpha_C)
     
    }

    

   
   
   
  
  
  
  

 }
#end

#declare transF = clock;

#if(transF > 0.5)
 #declare transF = 0.5-(transF-0.5);
#end

plane { 
       z, 0
       texture { 
   pigment{ checker rgb<0.5,0.5,0.5>, rgb<0.3,0.3,0.3>}
   finish {diffuse 0.5 ambient 0.5}
       }
       scale 200
       translate<(-2000*transF),0,-50>
    }

object{quadro(clock)
translate<(-2000*transF),0,0>
}
object{quadro(mod(clock+0.30,1.0))
translate<500+(-2000*transF),0,0>
}

// Original camera parameters:
// #local cam_ctr = <320,0,30>
// #local cam_vec = (<-1600,-900,1600>-<320,0,30>)
// #local cam_sky = z

#include "camlight.inc"
camlight(<320,0,30>,<10,10,10>,20.0,z,1.0)