// Last edited on 2010-12-15 19:05:29 by stolfilocal
// Processed by remove-cam-lights

#macro quadro(tt)

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

#declare raio = 2.000;

#declare angCoxa = abs(40*sin(2*pi*tt));

#declare angAnte = -abs(80*sin(2*pi*tt));

#declare angPe = abs(40*sin(2*pi*tt));

#macro interpola(ta, va, tb, vb, tt)
  #local s = (tt-ta)/(tb-ta);
  ((1-s)*va + s*vb)
#end

#declare t0 = 0.000;
#declare t1 = 0.250;
#declare t2 = 0.500;
#declare t3 = 0.750;
#declare t4 = 1.000;
#declare v0 = 0.0;
#declare v1 = -2;
#declare v2 = 0;
#declare v3 = 2;
#declare v4 = 0;

#if((tt >= t0) & (tt <= t1))
  #declare trans = interpola(t0, v0 ,t1, v1, tt);
#end
#if((tt >= t1) & (tt <= t2))
  #declare trans = interpola(t1, v1, t2, v2, tt);
#end
#if((tt >= t2) & (tt <= t3))
  #declare trans = interpola(t2, v2, t3, v3, tt);
#end
#if((tt >= t3) & (tt <= t4))
  #declare trans = interpola(t3, v3, t4, v4, tt);
#end

#declare tx_vermelho =
  texture{
    pigment{ color rgb < 1.00, 0.0, 0.10 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_amarelo =
  texture{
    pigment{ color rgb < 1.00, 1.0, 0.00 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#macro pe()
  union{
      box{
      < 0, 0, 0 >
      < -1, -1, -0.2 >
      texture { tx_amarelo }
    }
  }
#end

#macro anteperna(ang1)
  union{
    object{
      cylinder{
        < 0, 0, 0 >
        < 0, 0, -2 >
        0.35
        texture { tx_vermelho }
      }
    }
    object{ pe() rotate ang1*y translate <0,0.35,-2>}
  }
#end

#macro coxa(ang1, ang2)
  union{
    object{ anteperna(ang1) rotate ang2*y translate -1*z}
    object{
      cylinder{
          < 0, 0, 0 >
          < 0, 0, -1 >
          0.35
          texture { tx_vermelho }
      }
    }
  }
#end

#macro chassis(ang1, ang2, ang3)
  union{
    object{coxa(ang1,ang2) rotate ang3*y translate <-2,-2,-1>}
    object{coxa(ang1,ang2) rotate ang3*y translate <2,2,-1>}
    object{coxa(ang1,ang2) rotate ang3*y translate <2,-2,-1>}
    object{coxa(ang1,ang2) rotate ang3*y translate <-2,2,-1>}
    object{
      box{
        < -2, -2, 0 >
        < 2, 2, -1 >
        texture { tx_amarelo }
      }
    }
  }
#end

#macro animal(ang1,ang2,ang3,trans)
  union{
    object{ chassis(ang1, ang2, ang3) translate trans*z }
  }
#end

#include "eixos.inc"

union{

  object{ eixos(3.00) }

  object{ animal(angCoxa,angAnte,angPe, trans) translate 2*z}

}

#end //fim da macro

quadro(clock)

// Original camera parameters:
// #local cam_ctr = <0,0,0>
// #local cam_loc = <8.00,4.00,2.00>
// #local cam_vec = <8.00,4.00,2.00>
// #local cam_sky = z

#include "camlight.inc"
camlight(<0,0,0>,5.041,<10,10,10>,9.165,z,1.2)