// POV-Ray 3.6 / 3.7 include file "BarrelRoof_Yroof.inc" // author: Friedrich A, Lohmueller, Aug-2016 // homepage: www.f-lohmueller.de/ //------------------------------------------------------------------------ #ifndef( BarrelRoof_Yroof_Inc_Temp) #declare BarrelRoof_Yroof_Inc_Temp = version; #version 3.6; //------------------------------------------------------------------------------ ///////// //------------------------------------------------------------------------------ ///////// //--------------------------------------------------- macro: //--------------------------------------------------- BarrelRoofShape #macro BarrelRoof_Yroof( HalfWidth_X, // Roof_Height_Y, // Total_Height_Y, // Depth_Z, // // Merge__On, // ) // -------------------------- //--------------------------------------------------- #local D = 0.00001 ; #local B = HalfWidth_X; #local H = Roof_Height_Y; #if (Roof_Height_Y > HalfWidth_X ) #error "BarrelRoof_Yroof() macro called with 'UpperRoof_Height_Y' > 'HalfWidth_X' that can't be handled correctly" #end #declare Roof_Radius = ( B*B/H + H )/ 2; // B = R* sin( alpha ) #declare Roof_Angle = degrees( asin( B/Roof_Radius )); //--------------------------------------------------- #if ( (Total_Height_Y-Roof_Radius) > (Roof_Radius-Roof_Height_Y) ) #if (Merge__On = 1) // 1 merge{ // outer union/merge #else union{ #end #end intersection{ box{<-HalfWidth_X,0,0>, } cylinder{ <0,0,-D>,<0,0,Depth_Z+D>, Roof_Radius translate<0,Total_Height_Y-Roof_Radius,0> } } // end intersection ----------------------------------------------------------- ///////// #if ( (Total_Height_Y-Roof_Radius) > (Roof_Radius-Roof_Height_Y) ) // add base box: box{<-HalfWidth_X,0,0>, } } // end union #end // ------------------------------------------------------------------------------ ///////// #end// of macro ------------------------------------------------------------// end of macro //--------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------- // sample: /* //----------------------------------------------------------------------- //----------------------------------------------------------------------- #include "BarrelRoof_Yroof.inc" //----------------------------------------------------------------------- object{ BarrelRoof_Yroof( 1.00, // Half_Width_X, 0.30, // Roof_Height_Y, 1.50, // Total_Height_Y, 0.80, // Depth_Z, 0, //Merge__On, ) // --------------------------------------------- texture{ pigment{ color rgb< 1, 1, 1>*0.6 }// finish { phong 1 reflection 0.25 } } // end of texture translate<0,0,0> } // -------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- */ #version BarrelRoof_Yroof_Inc_Temp; #end //------------------------------------------------------------------- end of include file