// Fabio Negrello - exercicio 02
// ultima modificacao 05/10/00

background{ color rgb < 1, 1, 1 > }

light_source {
  < 3.00, 5.00, -8.00 >
  color rgb < 1.00, 1.00, 1.00 >
} 

camera {
  location  < 3.00, 5.00,-8.00 >
  look_at   < 0.00, 0.00, 0.00 >
} 
  
#declare casca =
  sphere {
    < 0.00, 0.00, 0.00 >, 2.00
    scale < 2, 1, 1 >
    texture { pigment { color rgb < 0.00, 0.00, 1.00 > }  }
  }

#declare janela2 =
  cylinder {
    < 0.00, 0.00, 5.00 >,
    < 0.00, 0.00, -5.00 >,
    2
    scale < 1.9, 1, 1 >    
    texture { pigment { color rgb < 1.00, 0.00, 0.00 > } }
  }

   
#declare roda1 =
  cylinder {
    < 0.00, 0.00, 0.00 >,
    < 0.00, 0.00, 1.00 >,
    0.70
    translate <2,-1,-2.0>
    texture { pigment { color rgb < 1.00, 0.00, 0.00 > } }
  }
        
#declare roda2 =
  cylinder {
    < 0.00, 0.00, 0.00 >,
    < 0.00, 0.00, 1.00 >,
    0.70
    translate < -2, -1, 2 >
    texture { pigment { color rgb < 1.00, 0.00, 0.00 > } }
  }

#declare roda3 =
  cylinder {
    < 0.00, 0.00, 0.00 >,
    < 0.00, 0.00, 1.00 >,
    0.70
    translate <-2,-1,-2>
    texture { pigment { color rgb < 1.00, 0.00, 0.00 > } }
  }
#declare roda4 =
  cylinder {
    < 0.00, 0.00, 0.00 >,
    < 0.00, 0.00, 1.00 >,
    0.70
    translate <2,-1,2>
    texture { pigment { color rgb < 1.00, 0.00, 0.00 > } }
  }
  
#declare basehelice =
  cylinder {
    < 0.00, 2.00, 0.00 >,
    < 0.00, 2.50, 0.00 >,
    0.20
    texture { pigment { color rgb < 1.00, 1.00, 1.00 > } }
  }
  
# declare helice1 =
  prism {
    linear_sweep
    linear_spline
    0,  // sweep the following shape from here ...
    0.1,  // ... up through here
    4, // the number of points making up the shape ...
    < 0, 0 >, < 5, 0.2>, < 5, -0.2>, <0, 0>
    translate <0,2.5,0> 
    texture { pigment { color rgb < 1.00, 1.00, 1.00 > } }
  }

  # declare helice2 =
  prism {
    linear_sweep
    linear_spline
    0,  // sweep the following shape from here ...
    0.1,  // ... up through here
    4, // the number of points making up the shape ...
    < 0, 0 >, < 5, 0.2>, < 5, -0.2>, <0, 0>
    translate <0,2.5,0>
    rotate <0, 180, 0>
    texture { pigment { color rgb < 1.00, 1.00, 1.00 > } }
  }
  
#declare caixa1 = 
  box {
    <-4, -4, -4>,
    <4, 1, 4>
  }    

#declare caixa2 =
  box {
    <-1, 0, -4>,
    <0.5, 4, 4>
  }

#declare alca1 =
  box {
    <0.5, 0, -2>, 
    <1, 0.3, 0>
    texture { pigment { color rgb < 1.00, 0.00, 0.00 > } }
  }

#declare alca2 =
  box {
    <0.5, 0, 0>, 
    <1, 0.3, 2>
    texture { pigment { color rgb < 1.00, 0.00, 0.00 > } }
  }

    
 union {
  object { roda1 } 
  object { roda2 } 
  object { roda3 } 
  object { roda4 } 
  object { basehelice }
  object { helice1 }
  object { helice2 }
  object { alca1 }
  object { alca2 }
 }

 
  difference { 
  object { casca }
  difference {
        object { janela2 }
        object { caixa1 }
        object { caixa2 }
  }
        
  }