// Exemplo de arquivo de descricao de cena para POV-ray
// Last edited on 2003-08-14 12:50:37 by taitlima

// ======================================================================
// CÂMERA 

camera {
  location  <  0.00, 30.00, 0.00 >  // Posição do observador.
  right     -1.0*x                 // Largura RELATIVA da imagem.
  up        0.75*y                 // Altura RELATIVA da imagem.      
  sky       z                      // Qual direção é "para cima"?
  look_at   <  0.00, 0.00, 0.00 >  // Para onde a câmera está apontando.
} 
// Nota: os parâmetros "right" e "up" devem ter a mesma proporção
// que os parâmetros ${WIDTH} e ${HEIGHT} no Makefile.

// ======================================================================
// FONTES DE LUZ

light_source {
  10 * < +50.0, +30.0, +50.0 >              // Posição da lâmpada.
  color rgb 1.2 * < 1.00, 1.00, 1.00 >   // Intensidade e cor da luz.
} 

light_source {
  10 * < +50.0, -10.0, +10.0 >             // Posição da lâmpada.
  color rgb 0.8 * < 1.00, 1.00, 1.00 >   // Intensidade e cor da luz.
} 

// ======================================================================
// DESCRIÇÃO DA CENA 
#include "colors.inc"
background{ color rgb < 0.75, 0.80, 0.85 > }




#declare R = seed(12345);


#declare distancia = 0
#declare numeroPernas = 0;
#declare limitePernas =  6;



  cylinder {
    <0, 0, 0>,     // Center of one end
    <0, -30, 0>,     // Center of other end
    5            // Radius
    pigment { Silver }
    translate <-1,0.7,-3>
  }

  
#while (numeroPernas <  limitePernas )


#declare gama  = -45*rand(R)
#declare alfa  = -45*rand(R)
#declare beta  = -90*rand(R)
#declare delta = -45*rand(R)

#declare parte4 = union {
  cylinder {
    <0, 0, 0>,     // Center of one end
    <3, 0, 0>,     // Center of other end
    0.5            // Radius
    pigment { Silver }
  }

  sphere {
    <0,0,0>, 0.5
    translate <3,0,0>
    pigment { Silver }
  }
  
}  


# declare parte3 = union {
  cylinder {
    <0, 0, 0>,     // Center of one end
    <3, 0, 0>,     // Center of other end
    0.5            // Radius
    pigment { Silver }
  }
  object { parte4
    rotate alfa*y
    translate <3,0,0>
  }

  sphere {
    <0,0,0>, 0.5
    translate <3,0,0>
    pigment { Silver }
  }

        
}

# declare parte2 = union {
  cylinder {
    <0, 0, 0>,     // Center of one end
    <3, 0, 0>,     // Center of other end
    0.5            // Radius
    pigment { Silver }
  }

  object { parte3
    rotate beta*y
    translate <3,0,0>
  }

  sphere {
    <0,0,0>, 0.5
    translate <3,0,0>
    pigment { Silver }
  }
    
}

# declare parte1 = union {
  cylinder {
    <0, 0, 0>,     // Center of one end
    <3, 0, 0>,     // Center of other end
    0.5            // Radius
    pigment { Silver }
  }
  object { parte2
    rotate gama*y
    translate <3,0,0>
  }

  sphere {
    <0,0,0>, 0.5
    translate <3,0,0>
    pigment { Silver }
  }
  

}


#declare tamanhoCorpo = -10

#declare pernas = union {

 object { parte1
   rotate delta*y
   translate <0,0,0>
 }

 object { parte1
   rotate delta*y
   rotate 180*z
   translate <tamanhoCorpo, 0,0>
 }

}

   object { pernas
     translate <4,-distancia,-3>
   }
   #declare numeroPernas=numeroPernas+1;
   #declare distancia = distancia + 5;
#end