// POV-Ray 3.6 / 3.7 include file "BarrelRoof_Rroof.inc" // author: Friedrich A, Lohmueller, July-2016 // homepage: www.f-lohmueller.de/ //------------------------------------------------------------------------ #ifndef( BarrelRoof_Rroof_Inc_Temp) #declare BarrelRoof_Rroof_Inc_Temp = version; #version 3.6; //------------------------------------------------------------------------------ ///////// //------------------------------------------------------------------------------ ///////// //--------------------------------------------------- macro: //--------------------------------------------------- BarrelRoofShape #macro BarrelRoof_Rroof( HalfWidth_X, // Roof_Radius, // Total_Height_Y, // Depth_Z, // // Merge__On, // ) // -------------------------- //--------------------------------------------------- #local D = 0.00001 ; #if (Roof_Radius < HalfWidth_X ) #error "BarrelRoof_Rroof() macro called with 'Roof_Radius' < 'HalfWidth_X' that can't be handled correctly" #end #local Ry = // roof center y sqrt( Roof_Radius*Roof_Radius - HalfWidth_X*HalfWidth_X ); #declare Roof_Height_Y = Roof_Radius - Ry ; #local B = HalfWidth_X; #declare Roof_Angle = degrees( asin( HalfWidth_X/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_Rroof.inc" //----------------------------------------------------------------------- object{ BarrelRoof_Rroof( 1.00, // Half_Width_X, 1.30, // Roof_Radius, 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_Rroof_Inc_Temp; #end //------------------------------------------------------------------- end of include file