// Last edited on 2003-05-31 10:14:06 by stolfi

#include "golds.inc"
#include "textures.inc"
#include "colors.inc"
#include "shapes.inc"
#include "glass.inc"
#include "metals.inc"
#include "woods.inc"

background{White}
#declare ctr = <0, 3, 0>;
camera {
    location ctr + 0.83*<-25, 10, -50>
    right 1.2*x up 0.9*y
    look_at ctr
  }
light_source { 10*<-20, 20, -20> color 1.2*White }
light_source { 10*<20, 20, -20> color 0.8*White }

#declare tecla1 =
 union {
  prism {
    linear_sweep
    linear_spline
    0,
    50,
    7,
    <3,5>, <-3,5>, <-5,0>, <-3,-5>, <3, -5>, <5,0>, <3,5>
    pigment { Green }
  }
  scale 0.2
  translate <-16, 0, 0>
 }

#declare tecla2 =
  cylinder {
    <0,0,0>,
    <0,10,0>,
    1.15
    pigment { Green }
    translate x*-8
  }

#declare tecla3 =
  prism {
    linear_sweep
    linear_spline
    0,
    35,
    4,
    <3,5>, <-3,5>, <0,0>, <3,5>
    pigment { Green }
    scale 0.3
  }


#declare tecla4 =
  prism {
    cubic_spline
    0,
    50, // ... up through here
    6, // the number of points making up the shape ...
    < 3, -5>, // point#1 (control point... not on curve)
    < 3,  5>, // point#2  ... THIS POINT ...
    <-5,  0>, // point#3
    < 3, -5>, // point#4
    < 3,  5>, // point#5 ... MUST MATCH THIS POINT
    <-5,  0>  // point#6 (control point... not on curve)
    pigment { Green }
    scale .2
    translate <8, 0, 0>
  }


#declare tecla5 =
  sor {
    5,
    <0.2,   0.4>,
    <0.2,   4.0>,
    <.6,   5.0>,
    <2.0,  10.0>,
    <2.5,  11.0>
    texture { Silver_Metal }
    translate y*-2
    rotate z*-30
    translate x*21
  }

// sólido de rotação
#declare corpo1 =
 lathe {
  linear_spline
  6,
  <0, 0>, <2, 2>, <0.5, 3.5>, <2, 5>, <0, 5>, <0, 0>
  pigment {Red}
 }

#declare corpo2 =
  object { corpo1 rotate z*180 translate y*10 }

#declare corpo =
  union {
    object { corpo1 }
    object { corpo2 }
    translate y*-5
    rotate z*90
    scale 3
    scale x*1.8
  }

#declare inst =
  union {
    object { corpo }
    object { tecla1 }
    object { tecla2 }
    object { tecla3 }
    object { tecla4 }
    object { tecla5 }
    rotate <-40,15,15>
  }

union {
  object { inst }
  plane {
    y, 0
    pigment { checker color 0.5*White + 0.5*Red, color 0.5*White + 0.5*Green scale 10 }
    translate -10*y
  }
}