// Last edited on 2019-07-17 09:35:58 by stolfilocal
// Processed by remove-cam-lights

background { color rgb < 0.74, 0.84, 0.92 > }

#declare roleta = seed(11031997);

#declare tx_azul =
  texture {
    pigment { color rgb <0.34, 0.45, 0.6> }
    finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_vermelho =
  texture {
    pigment { color rgb <1, 0.37, 0.34> }
    finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_laranja =
  texture {
    pigment { color rgb <0.96, 0.55, 0.26> }
    finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_verde =
  texture {
    pigment { color rgb <0.34, 0.6, 0.45> }
    finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#macro interpolalin (t0, v0, t1, v1, tt)
  #local r = (tt - t0) / (t1 - t0);
  #local s = 1 - r;
  #local vv = s * v0 + r * v1;

  vv
#end

#macro arcobezier (t0, t1, A, B, C, D, tt)
  #local AB = interpolalin(t0, A, t1, B, tt);
  #local BC = interpolalin(t0, B, t1, C, tt);
  #local CD = interpolalin(t0, C, t1, D, tt);

  #local ABC = interpolalin(t0, AB, t1, BC, tt);
  #local BCD = interpolalin(t0, BC, t1, CD, tt);

  #local ABCD = interpolalin(t0, ABC, t1, BCD, tt);

  ABCD
#end

#macro quadrado (R, N)
  #declare tamanho = 10;
  #declare l = tamanho / 2;

  union{
    #declare tt = 0;
    #while (tt < 1)

      sphere{ interpolalin(0, <-l, -l, 0>, 1, <+l, -l, 0>, tt), R texture {tx_azul} }
      sphere{ interpolalin(0, <+l, -l, 0>, 1, <+l, +l, 0>, tt), R texture {tx_vermelho}}
      sphere{ interpolalin(0, <+l, +l, 0>, 1, <-l, +l, 0>, tt), R texture {tx_laranja}}
      sphere{ interpolalin(0, <-l, +l, 0>, 1, <-l, -l, 0>, tt), R texture {tx_verde}}

      #declare tt = tt + (1 / N);
    #end
  }
#end

#macro curvaloca(R, N)
  #declare tamanho = 10;
  #declare l = tamanho / 2;

  union{
    #declare tt = 0;
    #while (tt < 1)

      sphere{ arcobezier(0, 1, <2, -6, -5>, <-10, 30, 0>, <30, -10, 0>, <-6, 2, 5>, tt), R texture {tx_azul} }
      sphere{ arcobezier(0, 1, <2, -6, -5>, <10, -30, 0>, <-30, 10, 0>, <-6, 2, 5>, tt), R texture {tx_verde} }

      #declare tt = tt + (1 / N);
    #end
  }
#end

#macro no1(R, N)
  #declare tamanho = 10;
  #declare l = tamanho / 2;

  union{
    #declare tt = 0;
    #while (tt < 1)

      sphere{ arcobezier(0, 1, <2, -6, -5>, <-10, 30, 0>, <30, -10, 0>, <-6, 2, 5>, tt), R texture {tx_azul} }
      sphere{ arcobezier(0, 1, <2, -6, -5>, <10, -30, 0>, <-30, 10, 0>, <-6, 2, 5>, tt), R texture {tx_verde} }

      #declare tt = tt + (1 / N);
    #end
  }
#end

union {

  object{ curvaloca(1, clock*1000) texture{ tx_azul } }

}

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 0.00 >;
#declare raio_cena = 20.0;
#declare dir_camera = < 10.00, 1.00, 1.00 >;
#declare dist_camera = 5*raio_cena;
#declare intens_luz = 1.20;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)