#include "colors.inc"

#include "textures.inc"



#declare zipper_gap = 2.9



#include "RoundBox1.INC"

#include "Zipper Tab.POV"

#include "Zipper Teeth.POV"



#include "Zipper Lock.POV"



#declare zipper1 = 

difference{

 box{<-6,0,0><6,-7.3,.75>}

 cylinder{<0,0,-1><0,0,1> 3 

          scale <1,7.25/3,1>

          translate<-6,-7.25,0>}

 cylinder{<0,0,-1><0,0,1> 3

          scale<1,7.25/3,1>

          translate<6,-7.25,0>}

}



#declare zipper2 = 

intersection{

 union{

  object{zipper1}

  torus{3, .4

        rotate<90,0,0>

        scale<1,7.25/3,.375/.4>

        translate<-6,-7.25,.75>

  }

  torus{3, .4

        rotate<90,0,0>

        scale<1,7.25/3,.375/.4>

        translate<6,-7.25,.75>

  }  

 }

 box{<-6,.1,-.1> <6,-7.25,1.5>}

 bounded_by{ box{<-6,0,0> <6,-7.25,1.5>}}

 rotate<0,0,180>

}  



#declare zipper3 = 

difference{

 object{zipper2}

 object{lockRoundBox rotate<0,0,90> scale<5/4,1,1> translate<2.5,4.75,0>}

 bounded_by{ box{<-6,0,0> <6,7.25,1.5>}}

}



#declare zipper4 = 

union{

	object{zipper3}

 box{<-.8,3.75,.75><.8,4.95,0>}

 box{<-.8,4.45,0><.8,4.95,-.5>}

 bounded_by{ box{<-6,0,-.5> <6,7.25,1.5>}}

}



#declare zipperTop1 =

intersection{

 union{

  intersection{

   difference{

    torus{2.25, 1.5 rotate<90,0,0> translate<0,-3.75,1.5>}

    torus{2.25, .75 rotate<90,0,0> translate<0,-3.75,1.5>}

   }//difference

   cylinder{<0,-3.75,10><0,-3.75,-10> 2.25}

  }//intersection

  difference{

   union{

    box{<-6,0,0><6,-4,.75>}

    box{<-6,0,2.25><6,-4,3>}

   }//union

   cylinder{<0,-3.75,10><0,-3.75,-10> 2.25}

  }//difference

 }//union

 cylinder{<0,0,10><0,0,-10> 4 scale <6/4,1,1>}

 bounded_by{box{<-6,0,-.5><6,-4,3>}}

}//intersection



#declare zipper5 = 

union{

	object{zipperTop1}

 object{zipper4}

 bounded_by{box{<-6,-4,3><6,7.25,-.5>}}

}



#declare zipper6 =

union{

 object{zipper5}

	object{zipper1 rotate<0,0,180> translate<0,0,2.25>}

 object{lockRoundBox scale<1.5/2,.75/4, .5/4> translate<-1.6,-.75,-.25>}

 object{lockRoundBox scale<1.5/2,.75/4,.5/4> translate<1.6,-.75,-.25>}

	bounded_by{box{<-6,-4,3><6,7.25,-.5>}}

}





#declare fly = 

union{

object{zipLock3 texture{Polished_Brass finish{crand .05}}}

object{tab5 texture{Brass_Metal finish{crand .05}} rotate<0,0,180> translate<0,3.5,0>}

object{zipper6 texture{Bronze_Metal finish{crand .05}}}

object{long_zip rotate<0,0,90> scale <3/4,.35,.4> translate<0,0,1.5>}

object{long_zip translate<zipper_gap *40,0,0> rotate<0,0,90> scale <3/4,.35,.4>

 translate<0,0,1.5>}



object{long_zip translate<zipper_gap *80,0,0> rotate<0,0,90> scale <3/4,.35,.4>

 translate<0,0,1.5>}

difference{

 box{<-200,-200,1.52><200,200,1.49>}

 box{<-1.5,200,200><1.5,-200,-200>}

 cone{<0,7.25,1.5> 0 <0,-200,1.5> 90}

 pigment{color White} normal{ripples 1 translate <100,0,0> scale 10}

}

difference{

 box{<-200,-200,1.6><200,200,1.4>}

 box{<-10,200,200><10,-200,-200>}

 cone{<0,7.25,1.5> 0 <0,-200,1.5> 90 scale (10/1.5)}

 pigment{color Blue} normal{ripples 2 scale 10}

}

object{half_zipper translate<0,1.5,0> rotate<0,0,90> scale<3/4,.35,.4> rotate<0,0,180-23.473285>

translate<0,7.25,1.5> texture{Brass_Metal}}

object{half_zipper translate<zipper_gap,1.5,0> rotate<180,0,0>  rotate<0,0,90> scale<3/4,.35,.4> rotate<0,0,180+23.473285>

translate<0,7.25,1.5> texture{Brass_Metal}}

plane{z,-50 texture{pigment{White_Marble}}}

plane{z,50 pigment{White_Marble} finish{reflection .6}}

//rotate<0,180,0>

}



object{fly rotate<0,0,0>}



camera{location<10,-20,-25> sky<-1,1,0> look_at<0,0,0> rotate<0,0,0>}

// An extended area light (soft shadows)

// WARNING: This can significantly slow down rendering times!

light_source

{

  0*x // light's position (translated below)

  color red 1.0  green 1.0  blue 1.0  // light's color

  // <widthVector> <heightVector> nLightsWide mLightsHigh

  area_light <8, 0, 0> <0, 8, 0> 6, 6

  adaptive 0    // or 1 or 2 

  jitter        // adds random softening of light

  translate <30,-15,-30>   // <x y z> position of light

}



//background{color White}



//box{<-100,-100,-100><100,100,100> texture{Stone13 scale 100}}

#declare tab1 = 

difference{

 box{<-4.5,0,.5> <4.5,18,-.5>

   clipped_by{

    cone{<0,0,0> 6 <0,18,0> 3}

   }

 }

 box{<-2.75,1,1> <2.75,6,-1>}

 box{<-3,1.25,1> <3,6,-1>}

 cylinder{<-2.75,1.25,1><-2.75,1.25,-1> .25}

 cylinder{<2.75,1.25,1><2.75,1.25,-1> .25}

 cylinder{<0,0,1><0,0,-1> 3 scale<1,2/3,1> translate<0,6,0>}

 bounded_by{box{<-4.5,0,.5><4.5,18,-.5>}}

}





#declare tab2 = 

difference{

 object{tab1}

 cone{<0,16,0> 2

      <0,12,0> 2.5

     }

}



#declare tab3 = 

union{

 difference{

  object{tab2}

  box{<-4,-1,-1><-5,.5,1>}

  box{<4,-1,-1><5,.5,1>}

 }

 cylinder{<-4,.5,.5> <-4,.5,-.5> .5}

 cylinder{<4,.5,.5><4,.5,-.5> .5}

 scale <1,1,.5>

}



#declare qcyl = 

intersection{

 cylinder{<0,0,0> <0,2,0> .5}

 box{<0,-1,0><1,3,-1>}

 bounded_by{ box{<0,0,0><1,2,-1>}}

}



#declare tab4 = 

union{

 difference{

  object{tab3}

  box{<-1,15,1><1,19,-1>}

 }

 object{qcyl translate<.5,16,-.25>}

 object{qcyl rotate<0,90,0> translate <-.5,16,-.25>}

 object{qcyl rotate<0,180,0> translate <1,16,-.25>}

 object{qcyl rotate<0,270,0> translate <-1,16,-.25>}

 box{<-.5,16,-.25> <.5,18,-.75>}

 bounded_by{box{<-4.5,0,-.75><4.5,18,.25>}}

}





#declare logoStamp = 

intersection{

height_field{gif "levis logo.gif" translate<-.5,0,0>}

box{<-.5,.1,0><.5,1,1>}

scale <6,1,3>

rotate<-90,0,0>

bounded_by{box{<-.5,.1,0><.5,1,1> scale <6,1,3>

rotate<-90,0,0>}}

}



#declare tab5 = 

difference{

 object{tab4}

 object{logoStamp rotate <0,0,180> translate<0,11,.2> texture{Polished_Brass}}

 bounded_by{box{<-4.5,0,-.75><4.5,18,.25>}}

}

#declare prong = 

union{

 sphere{<0,0,0> 1 

  scale <3,1,1.5> 

  translate<-1.5,6.5,1.5>

  clipped_by{

   box{<-1.5,5.5,0><1.5,7.5,3>}

  }

  bounded_by{clipped_by}

 }



 box{<0,2.5,0><-3,5.5,3>}

 box{<-1.5,5.5,0><-3,6.5,3>}

 cylinder{<0,0,0> <-1.5,0,0> 1

  scale<1,1,1.5>

  translate<-1.5,6.5,1.5>

 } 

 bounded_by{

  box{<1.5,2.5,0><-3,7.5,3>}

 }

 translate<0,-6.5,-1.5>

}



#declare zip_seg = 

union{

 object{prong }

 object{prong rotate<180,0,0> translate<zipper_gap*1,0,0>}

 object{prong translate<zipper_gap*2,0,0>}

 object{prong rotate<180,0,0> translate<zipper_gap*3,0,0>}

 object{prong translate<zipper_gap*4,0,0>}

 object{prong rotate<180,0,0> translate<zipper_gap*5,0,0>}

 object{prong translate<zipper_gap*6,0,0>}

 object{prong rotate<180,0,0> translate<zipper_gap*7,0,0>}

 texture{Brass_Metal normal{wrinkles .1 scale .2}}

}



#declare long_zip = 

union{

 object{zip_seg}

 object{zip_seg translate<zipper_gap*8,0,0>}

 object{zip_seg translate<zipper_gap*16,0,0>}

 object{zip_seg translate<zipper_gap*24,0,0>}

 object{zip_seg translate<zipper_gap*32,0,0>}

 texture{Brass_Metal normal{wrinkles .1 scale .2}}

 bounded_by{box{<-3,6.5,1.5><133,-6.5,-1.5>}}

}



#declare hz1 = 

union{

 object{prong}

 object{prong translate<zipper_gap*2,0,0>}

}

 

#declare hz2 = 

union{

 object{hz1}

 object{hz1 translate<zipper_gap*4,0,0>}

}



#declare hz3 = 

union{

 object{hz2}

 object{hz2 translate<zipper_gap*8,0,0>}

}

 

#declare hz4 = 

union{

 object{hz3}

 object{hz3 translate<zipper_gap*16,0,0>}

}

 

#declare hz5 = 

union{

 object{hz4}

 object{hz4 translate<zipper_gap*32,0,0>}

}



#declare half_zipper =

union{

 object{hz5}

 object{hz5 translate<zipper_gap*64,0,0>}

 bounded_by{box{<-3,2,3><128*zipper_gap,-6,-3>}}

}

 

#declare curveUp = 

intersection{

 box{<0,0,-2.5><1.5,.9,2.5>}

 union{

  difference{

   cylinder{<0,1.5,3><0,1.5,-3> 1.5}

   cylinder{<0,1.5,3.5><0,1.5,-3.5> 1.1}

   clipped_by{plane{<2,3,0> 0 translate<0,1,0>}}

  }

  difference{

   cylinder{<1.5,-.5,3><1.5,-.5,-3> 1.4}

   cylinder{<1.5,-.5,3.5><1.5,-.5,-3.5> 1}

   clipped_by{plane{<-2,-3,0> 0 translate<0,1,0>}}

  }

 }

 bounded_by{ box{<0,0,-2.5><1.5,.9,2.5>}}

}



#declare zipLock1 = 

union{

 object{curveUp rotate<0,-90,0> rotate<-90,0,0> scale<1,2,1>}

 difference{

  cylinder{<-2.5,0,0><2.5,0,0> .9 scale<1,2.25/.9,1> translate<0,3,0>}

  cylinder{<-3,0,0><3,0,0> .5 scale<1,1.85/.5,1> translate<0,3,0>}

  clipped_by{

   box{<-3,3,-1><3,6,0>}

  }

 }

 bounded_by{box{<-2.5,0,0><2.5,5.25,-.9>}}

}



#declare zipLock2 = 

difference{

	object{zipLock1 }

 object{lockRoundBox translate<0,3.75,-2>}

 bounded_by{box{<-2.5,0,0><2.5,5.25,-.9>}}

}



#declare zipLock3 = 

union{

 object{zipLock2}

 box{<-2.5,4.85,0><2.5,5.25,2.5>}

 difference{

  union{

   box{<-.75,0,-.4><.75,-3.25,0>}

   difference{

    cylinder{<-.75,-3.25,.1><.75,-3.25,.1> .5}

    cylinder{<-1,-3.25,.1><1,-3.25,.1> .1}

    clipped_by{

     box{<-1,-3.25,-1><1,-4,.1>}

    }

   }

   box{<-.75,-3.35,.1><.75,-3.75,.5>}

  }

  union{

   box{<-.1,-.5,-.5><.1,-3.35,-.3>}

   difference{

    cylinder{<-.1,-3.25,.1><.1,-3.25,.1> .6}

    cylinder{<-.2,-3.25,.1><.2,-3.25,.1> .4}

   }

  }

 }

 bounded_by{box{<-2.5,-3.75,.5><2.5,5.25,-.9>}}

}





#declare zipLock4 = 

difference{

 object{zipLock3}

 object{lockRoundBox translate<3,5,2.1>}

 object{lockRoundBox translate<-3,5,2.1>}

 bounded_by{box{<-2.5,-3.75,.5><2.5,5.25,-.9>}}

}

//Rounded corner rectangle.  Fully rounded, like a melted ice cube.

//Created using the program Create POV Round Box, by Michael C. Whidden.

//This box is 2.000000 wide, 4.000000 tall,

// 4.000000 deep with corners of radius 0.500000.

//It is *base-centered* on the origin

#declare lockRoundBox = union{

	      box{<0.500000,-2.000000,1.500000><-0.500000,2.000000,-1.500000>}

	      box{<0.500000,-1.500000,2.000000><-0.500000,1.500000,-2.000000>}

	      box{<1.000000,-1.500000,1.500000><-1.000000,1.500000,-1.500000>}

       cylinder{<0.500000,-1.500000,-1.500000><0.500000,1.500000,-1.500000> 0.500000}

       cylinder{<-0.500000,-1.500000,1.500000><-0.500000,1.500000,1.500000> 0.500000}

       cylinder{<-0.500000,-1.500000,-1.500000><-0.500000,1.500000,-1.500000> 0.500000}

       cylinder{<0.500000,-1.500000,1.500000><0.500000,1.500000,1.500000> 0.500000}

 	cylinder{<0.500000,-1.500000,1.500000><-0.500000,-1.500000,1.500000> 0.500000}

 	cylinder{<0.500000,-1.500000,-1.500000><-0.500000,-1.500000,-1.500000> 0.500000}

 	cylinder{<0.500000,1.500000,1.500000><-0.500000,1.500000,1.500000> 0.500000}

 	cylinder{<0.500000,1.500000,-1.500000><-0.500000,1.500000,-1.500000> 0.500000}

 	cylinder{<-0.500000,1.500000,1.500000><-0.500000,1.500000,-1.500000> 0.500000}

 	cylinder{<0.500000,1.500000,1.500000><0.500000,1.500000,-1.500000> 0.500000}

 	cylinder{<-0.500000,-1.500000,1.500000><-0.500000,-1.500000,-1.500000> 0.500000}

 	cylinder{<0.500000,-1.500000,1.500000><0.500000,-1.500000,-1.500000> 0.500000}

       sphere{<0.500000,1.500000,1.500000> 0.500000}

       sphere{<-0.500000,1.500000,1.500000> 0.500000}

       sphere{<0.500000,-1.500000,1.500000> 0.500000}

       sphere{<-0.500000,-1.500000,1.500000> 0.500000}

       sphere{<0.500000,1.500000,-1.500000> 0.500000}

       sphere{<-0.500000,1.500000,-1.500000> 0.500000}

       sphere{<0.500000,-1.500000,-1.500000> 0.500000}

       sphere{<-0.500000,-1.500000,-1.500000> 0.500000}

       translate<0,2.000000,0>

       bounded_by{box{<1.000000,4.000000,2.000000><-1.000000,0,-2.000000>}}

}//End object lockRoundBox