// POV-Ray 3.6 / 3.7 include file "Rounded_BarrelRoof_Yroof.inc" // author: Friedrich A, Lohmueller, Aug-2016 // homepage: www.f-lohmueller.de/ //------------------------------------------------------------------------ #ifndef( Rounded_BarrelRoof_Yroof_Inc_Temp) #declare Rounded_BarrelRoof_Yroof_Inc_Temp = version; #version 3.6; #ifndef ( Shapes3_Inc_Temp ) #include "shapes3.inc" #end //------------------------------------------------------------------------------ ///////// //------------------------------------------------------------------------------ ///////// #macro Rounded_BarrelRoof_Yroof( HalfWidth_X, // half width in x Roof_Height_Y,// R_Border, // border radius Depth_Z, // depth in Z Merge__On, // ) // -------------------------- //--------------------------------------------------- #local D = 0.00001 ; #if (Roof_Height_Y > HalfWidth_X ) #error "Rounded_BarrelRoof_Yroof() macro called with 'Roof_Height_Y' > 'HalfWidth_X' that can't be handled correctly" #end #if (Roof_Height_Y < R_Border) #error "Rounded_BarrelRoof_Yroof() macro called with 'Roof_Height_Y' < 'R_Border' that can't be handled correctly" #end #local HW_X = HalfWidth_X; #local HW_i = HW_X - R_Border; #local Hy_i = Roof_Height_Y - R_Border; ///////////////////////////////// #local B = HW_i; #local H = Hy_i; #local Roof_Top_Radius_i = ( B*B/H + H )/ 2; // B = R* sin( alpha ); // declared by applying this macro: #declare Roof_Angle = degrees( asin( B/Roof_Top_Radius_i )); #declare Roof_Top_Radius = Roof_Top_Radius_i + R_Border ; #declare R_Top = Roof_Top_Radius ; #declare H_Y = Roof_Height_Y ; #declare H_Circle = Roof_Top_Radius_i * cos( radians(Roof_Angle));; //--------------------------------------------------- #if (Merge__On = 1) // 1 merge{ // outer union/merge #else union{ #end intersection{ // 1 box{<-HW_X,-D,-D>, } //#macro Segment_of_CylinderRing ( R_out, R_in, Height, Segment_Angle) object{ Segment_of_CylinderRing ( Roof_Top_Radius , D, Depth_Z , -2*Roof_Angle ) scale <1,-1,1> rotate<-90,0,90-Roof_Angle> translate<0,-H_Circle,0> }//---------------------------------------------------------- } // end intersection 1 ----------------------------------------------------------- ///////// intersection{ // 2 box{<-HW_X,-D,-D>, } #if (Merge__On = 1) // 2 merge{ // outer union/merge #else union{ #end cylinder{ <0,0,D>,<0,0,Depth_Z >,R_Border translate<-HW_i,0,0> } // end of cylinder ------------------------------------ cylinder{ <0,0,D>,<0,0,Depth_Z >,R_Border translate< HW_i,0,0> } // end of cylinder ------------------------------------ } // end union/merge 2 } // end intersection 2 ----------------------------------------------------------- ///////// }// end union/merge 1 // ------------------------------------------------------------------------------ ///////// #end// of macro ------------------------------------------------------------// end of macro //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- // sample: /* //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- object{ Rounded_BarrelRoof_Yroof( 1.40, // Half_Width_X, // Half Width in x 0.72, // Roof_Height_Y, // s 0.50, // R_Border, // border radius 0.50, // Depht_Z, 0, // Merge__On, ) // -------------------------- // declares: H_Y and H_Circle texture{ pigment{ color rgb< 1, 1, 1>*0.6 }// // normal { bumps 0.5 scale 0.05 } finish { phong 1 reflection 0.00} } // end of texture translate<0,0,-0.01> } // -------------------------------------------------------------- //---------------------------------------------------------------------------------------11111111111 //--------------------------------------------------------------------------------------- */ #version Rounded_BarrelRoof_Yroof_Inc_Temp; #end //------------------------------------------------------------------- end of include file