#declare ChanfreinSize = 0.1;
#declare WoodBoardWidth = 0.5;
#declare WoodBoardLength = 6*2;
#declare DockWidth = 2*2;
#declare PilarSide = 0.25;

#declare SeedGen = seed(79230);

#declare WoodBoard = prism{ linear_spline linear_sweep 0, WoodBoardLength, 5, 
                            <0, 0>, 
                            < -ChanfreinSize, ChanfreinSize>,
                            < -WoodBoardWidth + ChanfreinSize, ChanfreinSize>,
                            < -WoodBoardWidth, 0>,
                            <0, 0>
}

#declare WoodPilar = cylinder{ < 0,-20, 0 >,< 0, 4 - ChanfreinSize, 0 >, 0.15 texture{T_Wood25} }

//Iron Ladder
#declare ToreGreatRadius = 0.4;
#declare LadderRadius = 0.1;
#declare LadderWidth = 1;
#declare StepExtent = 0.4;
#declare StepNumber = 4;
#declare HalfTore = difference{ torus{ToreGreatRadius, LadderRadius/2 rotate 90*x} box{<-ToreGreatRadius - LadderRadius , 0, LadderRadius>,
                                                                                     <ToreGreatRadius + LadderRadius ,-ToreGreatRadius - LadderRadius, -LadderRadius>} }
#declare LadderSide = cylinder{<0,4,0>,<0,2,0>, LadderRadius/2} 
#declare LadderStep = box{< LadderRadius / 2, 4 + LadderRadius / 2, LadderWidth / 2 >,<-LadderRadius / 2, 4 - LadderRadius / 2 , -LadderWidth / 2 > }


#declare Ladder = union{ object{HalfTore translate < 0, 4, -LadderWidth / 2 > }
                         object{HalfTore translate < 0, 4,  LadderWidth / 2 > }
                         object{LadderSide translate <ToreGreatRadius, 0, -LadderWidth / 2 > }
                         object{LadderSide translate <ToreGreatRadius, 0,  LadderWidth / 2 > }
                         
                         #for( it, 0, StepNumber, 1 )
                            object{LadderStep translate <ToreGreatRadius, - it*StepExtent, 0>}
                         #end
                  }


#declare WoodDock = union{
                          #for( it, 0, (DockWidth - WoodBoardWidth) / WoodBoardWidth, WoodBoardWidth )
                            object{ WoodBoard rotate -90*x translate <-6*2, 4, -8 * 2> translate -it * WoodBoardWidth * x 
                                texture{ T_Wood21 rotate 90*x
                                        translate < rand(SeedGen), 0, rand(SeedGen)>
                                }
                            }
                          #end
                          object{WoodPilar translate <-6 * 2 - PilarSide, 0, -14 * 2 + PilarSide>}
                          object{WoodPilar translate <-8 * 2 + PilarSide, 0, -14 * 2 + PilarSide >}
                          
                          object{Ladder translate <-6*2, 0, -13*2> pigment{color srgb 0.35} finish{specular 0.25 roughness 0.25 } } 
                    }