###### Descriptions and Examples for the POV-Ray Raytracerby Friedrich A. Lohmüller     POV-Ray Examples - How To Make Objects for POV-Ray
Italiano
Français
Deutsch

Home
- POV-Ray Tutorial
- POV-Ray Examples
Index of Content
- Geometry
- Architecture
- House
- Roof
- Tower
- Castle
- Window + Door
- Stairs
- Pyramid
- Columns
- Arch
- Fences
- Furnitur
- Household
- Engineering

# Roof

##### Step 2:Cutting off diagonally The part of the roof after being rotated and translated to its final position is cut off by two diagonal planes to its final shape.
 ```#macro Roof_quarter ( RAngle, // roof angle RLen, // roof length RWidth, // roof width ROver, // overhang RRCyl, // radius cylinders RCylDist // distance cylinders )//-------------------------- #local RSteep = // roof steep len sqrt( pow(RLen,2) +pow(RLen*tan(radians(RAngle)),2)); //---------------------------------------- intersection{ //a box with cylinders union{ box {<-ROver,0,-ROver>, < RSteep,0.01,RWidth+ROver> texture{Roof2}} #declare Nr = 0; // start #declare EndNr = (RWidth+2*ROver)/RCylDist; #while (Nr< EndNr) cylinder {<-ROver-0.01,0,0>, , RRCyl texture{Roof1} translate<0,0,-ROver+Nr*RCylDist>} #declare Nr = Nr + 1; // next Nr #end // --------------- end of the loop rotate<0,0,RAngle>}// end of union //cut off by diagonal planes: plane{<1,0,0>, 0 rotate<0, 45,0> texture{Roof1}} plane{<1,0,0>, 0 rotate<0,-45,0> translate<0,0,RWidth> texture{Roof1}} bounded_by{ box{<-ROver ,-RRCyl,-ROver>, } rotate<0,0,RAngle> } }//--------- end of intersection #end // end of macro //-------------------------------------```
##### Step 3:Placing the 4 quarters of the roof After this all borders between these parts are covered by cylinders, which simulate the tiled ridge.
 ```// -------------------------- macro RoofHeight(...)------- #macro RoofHeight(Len,Angle) Len*tan(radians(Angle)) #end // -------------------------- macro RoofDiag(...)--------- #macro RoofDiag (ROver, R_Len, R_Angle, RoCyl_R) #local RXOver = ROver*cos(radians(RoofAngle)); #local RYOver = ROver*sin(radians(RoofAngle)); cylinder{<-RXOver,-RYOver,-RXOver>, , 1.2*RoCyl_R texture{Roof1 rotate<0,-45,R_Angle>}} #end // end of macro // --------------------------- macro Roof(...) ----------- #macro Roof (RoAngle1, // roof angle RoLen_X11,// lenght in x RoLen_X12,// lenght in z RoWideZ11,// width x parts RoWideZ12,// width z parts RoOver, // overhang R_Cyl, // radius cylinders Cyl_D) // distance cylinders union{ object{ Roof_quarter(RoAngle1,RoLen_X11,RoWideZ11, RoOver,R_Cyl,Cyl_D) translate< 0,0,0>} object{ Roof_quarter(RoAngle1,RoLen_X11,RoWideZ11, RoOver,R_Cyl,Cyl_D) scale<-1,1,1> translate} object{ Roof_quarter(RoAngle1,RoLen_X12,RoWideZ12, RoOver,R_Cyl,Cyl_D) rotate<0, 90,0>translate<0.00,0,RoWideZ11>} object{ Roof_quarter(RoAngle1,RoLen_X12,RoWideZ12, RoOver,R_Cyl,Cyl_D) rotate<0,-90,0>translate} union{ object{ RoofDiag (RoOver, RoLen_X11, RoAngle1, R_Cyl) translate< 0,0,0>} object{ RoofDiag (RoOver, RoLen_X11, RoAngle1, R_Cyl) rotate<0,-90,0> translate} object{ RoofDiag (RoOver, RoLen_X11, RoAngle1, R_Cyl) rotate<0,180,0> translate} object{ RoofDiag (RoOver, RoLen_X11, RoAngle1, R_Cyl) rotate<0, 90,0> translate< 0,0,RoWideZ11>} cylinder{<0,0,0>,<0,0,RoWideZ11-RoWideZ12>,1.2*R_Cyl translate texture{Roof1 rotate<0,90,0>} }// end of cylinder translate<0,0.05,0>} } #end // -----------------end of Roof(...) macro ------```
##### Ready-made POV-Ray objects as include files and example files you'll find at the POV-Ray Objects Page
top

 © Friedrich A. Lohmüller, 2006 www.f-lohmueller.de