// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.6
// Desc: Basic Scene Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.6;

#include "colors.inc"
#include "golds.inc"
#include "metals.inc"
#include "shapes.inc"


#declare ground=box{-20*(x+z),20*(x+z)-.1*y

         pigment {Brown *.1+Tan*.05 }
         normal {
           spotted
           turbulence 2
           lambda 2
           normal_map {
             [0.4 dents .15 scale .025]
             [0.55 agate turbulence 1 scale 3]
             [0.85 agate turbulence 2 scale 5]
           }
         }


}


#declare r_height=.74;
#declare r_bend_radius=.3;
#declare r_pipe_radius=.015;
#declare r_length=1.95;

#declare rail=union{
     cylinder{0,(r_length-r_bend_radius)*x,r_pipe_radius translate y*r_height}
     cylinder{0,(r_height-r_bend_radius)*y,r_pipe_radius translate x*r_length}
     intersection{
          torus{r_bend_radius,r_pipe_radius}
          box{-r_pipe_radius*y,r_pipe_radius*y+(r_bend_radius+r_pipe_radius)*(x+z)
          }
        rotate -x*90 translate x*(r_length-r_bend_radius)+y*(r_height-r_bend_radius) 
     }
}

#declare floor_slice=intersection{
     //cylinder{0,-.02*y, 1.75}
     box{-1.75*x,1.75*(x+z)-.05*y rotate y*30}
     Wedge(60)
}



#declare merry_go_round=union{
     union{
          cylinder{-.5*y,(r_height+2*r_pipe_radius)*y,2*r_pipe_radius}
          intersection{
               sphere{0,2*r_pipe_radius scale <1,.75,1> translate (r_height+2*r_pipe_radius)*y}
               cylinder{0,2*(r_height+5*r_pipe_radius)*y,2*r_pipe_radius}
     
          }
          object{rail}
          object{rail rotate 60*y}
          object{rail rotate 120*y}
          object{rail rotate 180*y}
          object{rail rotate 240*y}
          object{rail rotate 300*y}
          rotate y*30
          texture{T_Chrome_5D}
     }
     
     
     union{
          object{floor_slice pigment{color rgb <1,0,0>}}
          object{floor_slice pigment{color rgb <1,0,1>} rotate 60*y}
          object{floor_slice pigment{color rgb <0,0,1>} rotate 120*y}
          object{floor_slice pigment{color rgb <.0,1,1>} rotate 180*y}
          object{floor_slice pigment{color rgb <0,1,0>} rotate 240*y}
          object{floor_slice pigment{color rgb <1,1,0>} rotate 300*y}
          cylinder{0,-.05*y,2.1 translate -1e-4*y pigment{Brown*.25}}
     
     } 
}

//swing

#declare seat_width=.4;
#declare seat_depth=.2;

 
#declare sw_set_width=5;
#declare sw_set_depth=4;
#declare sw_set_height=3;
#declare seat_height=.75;

#declare seat =union{
     intersection{
          box{-seat_width/2*x-seat_depth/2*z,seat_width/2*(x-y)+seat_depth/2*z}
          difference{
               cylinder{-seat_depth/2*z,seat_depth/2*z,seat_width/2}
               cylinder{-seat_depth*z,seat_depth*z,seat_width/2*.95}
          }
          scale <1,.6,1>
          pigment{Gray*.1}
     }
     union{
          cylinder{-seat_depth/2*z,+seat_depth/2*y,.005 translate seat_width/2*x }   
          cylinder{seat_depth/2*z,+seat_depth/2*y,.005 translate seat_width/2*x }   
          cylinder{-seat_depth/2*z,+seat_depth/2*y,.005 translate -seat_width/2*x }   
          cylinder{seat_depth/2*z,+seat_depth/2*y,.005 translate -seat_width/2*x }   
          texture{T_Chrome_5D}
     }
     union{
          cylinder{+seat_depth/2*y,(sw_set_height-seat_height)*y,.010 translate seat_width/2*x }   
          cylinder{+seat_depth/2*y,(sw_set_height-seat_height)*y,.010 translate -seat_width/2*x }
          pigment{Tan*.5}   
     }
     translate seat_height*y
     rotate y*0

}

#declare swing_set=union{
     union{
          cylinder{-sw_set_depth/2*z,+sw_set_height*y,r_pipe_radius*1.5 translate sw_set_width/2*x }   
          cylinder{sw_set_depth/2*z,+sw_set_height*y,r_pipe_radius*1.5 translate sw_set_width/2*x }   
          cylinder{-sw_set_depth/2*z,+sw_set_height*y,r_pipe_radius*1.5 translate -sw_set_width/2*x }   
          cylinder{sw_set_depth/2*z,+sw_set_height*y,r_pipe_radius*1.5 translate -sw_set_width/2*x }
          cylinder{-sw_set_width/2*x,sw_set_width/2*x,r_pipe_radius*1.5 translate sw_set_height*y }
             
          texture{T_Chrome_1A}
     }

     object{seat}
     object{seat translate -1.5*x}
     object{seat translate 1.5*x}
     
     rotate -y*00
     translate -0*x+6*z
}
//seesaw
#declare ss_height=.4;
#declare ss_bend_radius=.15;
#declare ss_pipe_radius=.015;
#declare ss_pipe_width=0.6;
#declare ss_board_width=.25;
#declare ss_board_thick=.05;
#declare ss_board_length=5;
#declare ss_board_angle=10;
#declare ss_handle_height =.20;
#declare ss_handle_width =.4;
#declare ss_handle_radius = .025;
#declare ss_handle_dist =ss_board_length/2-.5;
#declare seesaw=union{
     union{
          cylinder{ss_bend_radius*x,(ss_pipe_width-ss_bend_radius)*x,ss_pipe_radius translate y*ss_height}
          cylinder{0,(ss_height-ss_bend_radius)*y,ss_pipe_radius translate x*ss_pipe_width}
          cylinder{0,(ss_height-ss_bend_radius)*y,ss_pipe_radius }
          intersection{
               torus{ss_bend_radius,ss_pipe_radius}
               box{-ss_pipe_radius*y,ss_pipe_radius*y+(ss_bend_radius+ss_pipe_radius)*(x+z)
               }
             rotate -x*90 translate x*(ss_pipe_width-ss_bend_radius)+y*(ss_height-ss_bend_radius) 
          }
          intersection{
               torus{ss_bend_radius,ss_pipe_radius}
               box{-ss_pipe_radius*y,ss_pipe_radius*y+(ss_bend_radius+ss_pipe_radius)*(x+z)
               }
             rotate -x*90  translate y*(ss_height-ss_bend_radius)-x*ss_bend_radius scale <-1,1,1>
          }
               texture{T_Chrome_1A}
          translate -x*ss_pipe_width/2
          rotate y*90
     }
      
     box{0,<ss_board_length,ss_board_thick,ss_board_width> 
          translate -<ss_board_length,0,ss_board_width>/2
          rotate z*ss_board_angle 
          translate (ss_height+ss_pipe_radius)*y
          pigment{Green*.05+Brown*.05}
     }
     union{
          cylinder{0,(ss_handle_height+ss_handle_radius)*y,ss_handle_radius translate ss_handle_dist*x}
          cylinder{0,ss_handle_width*z,ss_handle_radius translate ss_handle_dist*x+ss_handle_height*y-ss_handle_width*z/2}
          cylinder{0,(ss_handle_height+ss_handle_radius)*y,ss_handle_radius translate -ss_handle_dist*x}
          cylinder{0,ss_handle_width*z,ss_handle_radius translate -ss_handle_dist*x+ss_handle_height*y-ss_handle_width*z/2}
          texture{T_Chrome_4D}
          rotate z*ss_board_angle 
          translate (ss_height+ss_pipe_radius)*y
     
     }
     
}   
#declare ws=.75;
#declare R=1;         // radius of turn
#declare q=45;          // angle of slope
#declare L1=2.50;        // length of first section of track

#declare L3=.50;         // Length of second section of straight track
#declare slide=union{
     union{
          box { <0, 0, -ws/2>, <-L1, -.02, ws/2> translate -R*y rotate -z*q translate R*y}
          box { <0, 0, -ws/2>, <L3, -.02, ws/2> }
          intersection{ 
                object{Wedge(q)}
                difference{
                        cylinder { <0, -ws/2, 0>, <0,ws/2, 0>, R+.02 }
                        cylinder { <0, -ws, 0>, <0,ws, 0>, R}
                }
                rotate x*90 translate y*R scale <-1,1,1>
          }
          texture {T_Brass_5E }  
          translate .5*y
     }  
          
     union{
          cylinder{0,.49*y,.02 translate (L3-.1)*x+(ws/2-.1)*z}
          cylinder{0,.49*y,.02 translate (L3-.1)*x-(ws/2-.1)*z}
          cylinder{0,(L1+R)*sin(radians(q))*y+.25*y,.02 translate -(L1+R)*cos(radians(q))*x-(ws/2-.05)*z}
          cylinder{0,(L1+R)*sin(radians(q))*y+.25*y,.02 translate -(L1+R)*cos(radians(q))*x+(ws/2-.05)*z}
          cylinder{-.5*x,(L1+R)*sin(radians(q))*y+.25*y,.02 translate -(L1+R)*cos(radians(q))*x-(ws/2-.05)*z}
          cylinder{-.5*x,(L1+R)*sin(radians(q))*y+.25*y,.02 translate -(L1+R)*cos(radians(q))*x+(ws/2-.05)*z}
          #declare rvec=.5*x+(L1+R)*sin(radians(q))*y+.25*y;
          cylinder{-(ws/2-.05)*z,+(ws/2-.05)*z,.02 translate -(L1+R)*cos(radians(q))*x+.15*rvec-.5*x}          
          cylinder{-(ws/2-.05)*z,+(ws/2-.05)*z,.02 translate -(L1+R)*cos(radians(q))*x+.3*rvec-.5*x}          
          cylinder{-(ws/2-.05)*z,+(ws/2-.05)*z,.02 translate -(L1+R)*cos(radians(q))*x+.45*rvec-.5*x}          
          cylinder{-(ws/2-.05)*z,+(ws/2-.05)*z,.02 translate -(L1+R)*cos(radians(q))*x+.6*rvec-.5*x}          
          cylinder{-(ws/2-.05)*z,+(ws/2-.05)*z,.02 translate -(L1+R)*cos(radians(q))*x+.75*rvec-.5*x}          
          cylinder{-(ws/2-.05)*z,+(ws/2-.05)*z,.02 translate -(L1+R)*cos(radians(q))*x+.9*rvec-.5*x}          
     }     
     texture{T_Chrome_1A}
}   

#declare jj_height =2.25;
#declare jj_width =.75;
#declare jj_length=4;
#declare jj_prad=.03;
#declare jj_hrad=.015;

#declare bars=union{
     cylinder{0,jj_height*y,jj_prad translate <jj_length,0,jj_width>/2 }          
     cylinder{0,jj_height*y,jj_prad translate <-jj_length,0,jj_width>/2 }          
     cylinder{0,jj_height*y,jj_prad translate <jj_length,0,-jj_width>/2 }          
     cylinder{0,jj_height*y,jj_prad translate -<jj_length,0,jj_width>/2 }          

     cylinder{-jj_width/2*z,jj_width/2*z,jj_prad translate <-jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_prad translate <+jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_prad translate <-jj_length/2,.5,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_prad translate <+jj_length/2,.5,0>}

     cylinder{-jj_length/2*x,jj_length/2*x,jj_prad translate <0,jj_height,jj_width/2>}
     cylinder{-jj_length/2*x,jj_length/2*x,jj_prad translate <0,jj_height,-jj_width/2>}

     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <+.2*jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <+.4*jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <+.6*jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <+.8*jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <-.2*jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <-.4*jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <-.6*jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <-.8*jj_length/2,jj_height,0>}
     cylinder{-jj_width/2*z,jj_width/2*z,jj_hrad translate <0,jj_height,0>}
     texture{T_Chrome_1A}


}  