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

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

#declare tx_plastico =
  texture{
    pigment{ color rgb < 0.00, 0.80, 0.00 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.2 roughness 0.005 }
  }

#declare tx_fosca =
  texture{
    pigment{ color rgb < 1.00, 0.0, 0.10 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_xadrez =
  texture{
    pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > }
    finish{ diffuse 0.9 ambient 0.1 }
    scale 2.0
  }

#macro interpola(f0, v0, f1, v1, f)
        #local ss = (f-f0)/(f1-f0);
        #local rr = 1 - ss;

        (rr*v0 + ss*v1)
#end

#macro interpola4(t0, v0, v1, v2, v3, t1, tt)
        #local itp01 = interpola(t0, v0, t1, v1, tt);
        #local itp12 = interpola(t0, v1, t1, v2, tt);
        #local itp23 = interpola(t0, v2, t1, v3, tt);
        #local itp012 = interpola(t0, itp01, t1, itp12, tt);
        #local itp123 = interpola(t0, itp12, t1, itp23, tt);
        #local itp0123 = interpola(t0, itp012, t1, itp123, tt);

        itp0123
#end

#declare ponto = sphere {<0,0,0>, 0.6}

#macro grafico(x0, y0, y1, y2, y3, x3, N)
        #local aux = (x3-x0) / 200;
        #local i = N*800;

                        #local xaxis = i*aux + x0;
                        #local yaxis = interpola4(x0, y0, y1, y2, y3, x3, xaxis);

                        object { ponto translate <xaxis, 0, 0> translate yaxis }

#end

#include "eixos.inc"
#include "retalho.inc"

union{
        #if(clock<0.251)
        object{ grafico(-10, <1,1,1>, <0,0,0>, <8,8,8>, <5,5,5>, -5, clock) texture{ tx_fosca } }
        #else
          #if(clock<0.501)
            object{ grafico(-5, <5,5,5>, <2,2,2>, <3,3,3>, <15/2,15/2,-9/2>, 0, clock-0.25) texture{ tx_fosca } }
          #else
            #if(clock<0.751)
              object{ grafico(0, <15/2,15/2,-9/2>, <12,12,-12>, <5,5,5>, <1/2,1/2,3>, 5, clock-0.5) texture{ tx_fosca } }
            #else
              object{ grafico(5, <1/2,1/2,3>, <-4,-4,1>, <0,0,0>, <1,1,1>, 10, clock-0.75) texture{ tx_fosca } }
            #end
          #end
        #end
        scale 0.5
        rotate 270
}

#include "camlight.inc"
#declare centro_cena = < 2, 0, 0 >;
#declare raio_cena =20;
#declare dir_camera = < 0, 1, 2 >;
#declare dist_camera = 16.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)