// Last edited on 2013-12-11 09:20:42 by stolfilocal
// Processed by remove-cam-lights

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

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

#declare tx_plastico2 =
  texture{
    pigment{ color rgb < 0.90, 0.80, 1.00 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_plastico3 =
  texture{
    pigment{ color rgb < 0.90, 0.40, 0.20 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

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

#declare tx_fosca2 =
  texture{
    pigment{ color rgb < 0.80, 0.40, 0.40 > }
    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
  }

#declare chao =
  box{ <-20,-20,-1>, <+20,+20,0> }

#macro Interpola2(p0, p1, tt)
     ((1-tt)*p0 + tt*p1)
#end

#macro Interpola4(p0,p1,p2,p3,tt)
    #local p01 = Interpola2(p0,p1,tt);
    #local p12 = Interpola2(p1,p2,tt);
    #local p23 = Interpola2(p2,p3,tt);
    #local p012 = Interpola2(p01,p2,tt);
    #local p123 = Interpola2(p12,p3,tt);
    #local p0123 = Interpola2(p012,p123,tt);
    p0123
#end

#macro criareta(pp0, pp1, tt)
   #local i = 0;

   #while(i <=1)
      object{sphere{ Interpola2(pp0, pp1, i*tt), 0.1 texture {tx_plastico}}}
      #local i = i + 1;
   #end
#end

#macro criacurva(pp0,pp1,pp2,pp3)
   #declare i = 0;
   #local pl = pp0;

   #while(i<=1)
      #local pl = Interpola4(pp0,pp1,pp2,pp3, i);
      object{sphere{pl, 0.1 texture {tx_plastico}}}
      #declare i = i + 0.1;
   #end
#end

#macro criacurvavar(pp0,pp1,pp2,pp3,raio1, raio2, tt, ttr)
union{
   #declare i = 0;
   #declare rr = raio1;
   #local pl = pp0;
   #while(i<=1)
      #local pl = Interpola4(pp0,pp1,pp2,pp3, i);
      object{sphere{pl, Interpola2(raio1,raio2,rr) texture {tx_plastico}}}
      #declare i = i + tt;
      #declare rr = rr + ttr;
   #end
}
#end

#macro criacurva2(pp0,pp1,pp2,qq0,qq1,qq2)
   union{
   object{criacurvavar(pp0,pp1,pp2,(pp2+qq0)/2,0.3, 0.1, 0.1,0.07)}
   object{criacurvavar((pp2+qq0)/2,qq0,qq1,qq2,0.1, 0.05, 0.1,0.07)}
   }

#end

#include "eixos.inc"

#macro polvo()
union{
   difference{
     union{
       object{
          sphere{<0,0,0.7>, 1 texture {tx_plastico}}
       }
       object{
          sphere{<0.7,0.7,0.7>, 0.2 texture {tx_plastico}}
       }
     }
     union{
       object{
          sphere{<0.8,0.3,1>, 0.2 texture {tx_plastico}}
       }
       object{
          sphere{<0.3,0.8,1>, 0.2 texture {tx_plastico}}
       }
     }
   }
   object{criacurva2(<0,0,0>,<1,1,1>,<1.5,1.5,0.5>,<2,2,0>,<2.5,2.5,-0.5>,<3,3,0.25>) translate<0.5,0.5,0>}
   object{criacurva2(<0,0,0>,<1,1,1>,<1.5,1.5,0.5>,<2,2,0>,<2.5,2.5,-0.5>,<3,3,0.25>) translate<0.5,0.5,0> rotate <0,0,90>}
   object{criacurva2(<0,0,0>,<1,1,1>,<1.5,1.5,0.5>,<2,2,0>,<2.5,2.5,-0.5>,<3,3,0.25>) translate<0.5,0.5,0> rotate <0,0,180>}
   object{criacurva2(<0,0,0>,<1,1,1>,<1.5,1.5,0.5>,<2,2,0>,<2.5,2.5,-0.5>,<3,3,0.25>) translate<0.5,0.5,0> rotate <0,0,270>}
   object{criacurva2(<0,0,0>,<1,1,-1>,<1.5,1.5,-0.5>,<2,2,0>,<2.5,2.5,0.5>,<3,3,-0.25>) translate<0.5,0.5,0> rotate <0,0,45>}
   object{criacurva2(<0,0,0>,<1,1,-1>,<1.5,1.5,-0.5>,<2,2,0>,<2.5,2.5,0.5>,<3,3,-0.25>) translate<0.5,0.5,0> rotate <0,0,135>}
   object{criacurva2(<0,0,0>,<1,1,-1>,<1.5,1.5,-0.5>,<2,2,0>,<2.5,2.5,0.5>,<3,3,-0.25>) translate<0.5,0.5,0> rotate <0,0,225>}
   object{criacurva2(<0,0,0>,<1,1,-1>,<1.5,1.5,-0.5>,<2,2,0>,<2.5,2.5,0.5>,<3,3,-0.25>) translate<0.5,0.5,0> rotate <0,0,315>}
}
#end

union{
  object{ eixos(3.00) }
  object{ chao  translate < 0,0,-5 > texture{ tx_xadrez } }
  object{ polvo()}
}

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 1.00 >;
#declare raio_cena = 6.0;
#declare dir_camera = < 14.00, 7.00, 4.00 >;
#declare dist_camera = 16.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)