UnitMath Example: ( Hip Roof )
Last Modified 12/8/1999
This example shows how to calculate all of the many pieces needed to make a hip roof; given only the roof's ( length, width, and pitch ).
I have tried to make sure the following formulas are correct, but I do not guarantee them.
With the information above we find the information needed to make each of the following: Ridge, Normal Rafters, End Rafters, Hip Rafters, and Jack Rafters. ( see the following figure ) We also find the squares of shingles and # sheets of plywood to cover the roof.
Derivation TOP
Following is the derivation of the formulas used, and drawings showing the what the various measurements indicate.
The following figures show the axis and several useful points used in the following calculations. Point O is the origin of the axis, point T is the top of the hip rafter on the bottomleft side.
The pitch of a roof is normally given in the form: " pitch: 4 inch / (12 inch)". For calculations, We need the pitch as an angle so:
pitchAngle: atan( pitch );
All rafters are assumed to be made from 2 by X stock which has a thickness of ( 1 + 1/2 ) inch. If that is not the case you would change the following.
thickness: ( 1 + 1/2 ) inch;
Point T ( shown below ) is used in several calculations. Note: Point O is the origin which has the coordinates (0,0,0). With this choice of origin the coordinates of T are also the values for the vector T.
The coordinates for T are:
Ty: (sideR  thickness) / 2;
Tx: Ty;
Tz: Ty tan( pitchAngle );
T: Tx `i + Ty `j + Tz `k;
The length of the ridge is:
RidgeLength: sideF  2 Tx;
Hip Rafters TOP
The following figure shows the front part of the roof looking normal ( perpendicular ) to the surface.
The length of all the hip rafters are the same and equal to the length of vector T. angle_1 is used to find the lengths of the jack rafters. ( See angle notes )
HipLength: abs( T );
angle_1: acos(Tx / HipLength );
Next is a detailed view of a hip rafter, and the formula to find the HipAngle.
C: 0 m `i + 0 m `j + m `k;
HipAngle: acos( T dot C / ( abs( T ) abs( C ) ) );
The other cut for the Hip Rafter is 90 deg as shown below.
Plywood Cuts at the Hip Rafters TOP
Given angle_1 ( found above ), we can cut the plywood for the roof at the hip rafters, but angles are difficult to measure. It is easier to measure the length cut off as shown below.
Normal & End Rafters TOP
The normal and end rafters have the same dimensions. ( See angle notes )
length_NR: sqrt(sq HipLength  sq Tx );
angleRafter: 90 deg  pitchAngle;
Jack Rafters TOP
The angles for the double miter cut on the jack rafter are shown below. ( See angle notes )
The Next figure shows an overview of jack rafter.
The Next figure shows the same rafter in much more detail.
The length of a given jack rafter is found by first finding the x location, and then finding the length at that point. To simplify matters, you only need specify the # (JRN) of the jack rafter you are looking for. JRN 1 is the first rafter after the last full rafter, 2 is the next, etc. angle_1 was found in the hip rafter section.
RafterSpacing: 16 inch;
Rx: Tx + thickness;
Jackx: Rx  JRN * RafterSpacing;
Gx: thickness cos( 45 deg );
jackLenght: ( Jackx  Gx ) tan( angle_1 );
The number of jack rafters on each side of the hip rafter assuming that we don't want any closer than 1 foot from the hip rafter is:
numberOfJackRafters: ( Tx  ft ) / RafterSpacing  frac( ( Tx  ft ) / RafterSpacing );
Roof Area TOP
The following calculations find the area of the roof.
AreaSide: Tx * length_NR + thickness * length_NR;
AreaFront: RidgeLength * length_NR + Tx * length_NR;
RoofArea: 2 * AreaFront + 2 * AreaSide + RidgeLength * thickness;
The following are used to find the area of the roof in terms of squares of shingles, and sheets of plywood.
Squares: 100 sq ft;
PlywoodSheets: 4 ft * 8 ft;
Each of the edges will have to be covered by shingles. The following calculation is for 3 tab shingles, and finds the number of shingles needed to cover the edges. It is assumed that each shingle has 4 inches exposed ( I'm not sure if that is a reasonable number, email me if you have a better number ).
edges: RidgeLength + 4 * HipLength;
shinglesForEdges: edges / (4 in) / 3;
Following are several example calculations.
Example1: sideR: 24 ft; sideF: 56 ft; pitch: 4 in / ( 12 in ); TOP
This example uses the same information as is presented in the above drawings. Using a CAD program, I've confirmed everything, but the HipAngle. The HipAngle was confirmed by "Rob" a P.E. on the alt.architecture newsgroup.
 "Define the givens"

sideR: 24 ft;
sideF: 56 ft;
pitch: 4 in / ( 12 in );
 "Define the Equations"

thickness: ( 1 + 1/2 ) inch "Standard 2 by X";
pitchAngle: atan( pitch );
Ty: (sideR  thickness) / 2; Tx: Ty; Tz: Ty tan( pitchAngle );
T: Tx `i + Ty `j + Tz `k;
HipLength: abs( T ) as ft & in & in/16;
RidgeLength: sideF  2 Tx as ft & in & in/16;
length_NR: sqrt(sq HipLength  sq Tx ) as ft & in & in/16;
angleRafter: 90 deg  pitchAngle as deg;
angle_1: acos(Tx / HipLength );
C: 0 m `i + 0 m `j + m `k;
HipAngle: acos( T dot C / ( abs( T ) abs( C ) ) ) as deg;
RafterSpacing: 16 inch;
Rx: Tx + thickness;
Jackx: Rx  JRN * RafterSpacing as ft & in & in/16;
Gx: thickness cos( 45 deg ) as in;
jackLenght: ( Jackx  Gx ) tan( angle_1 ) as ft & in & in/16;
numberOfJackRafters: ( Tx  ft ) / RafterSpacing  frac( ( Tx  ft ) / RafterSpacing );
AreaSide: Tx * length_NR + thickness * length_NR;
AreaFront: RidgeLength * length_NR + Tx * length_NR;
RoofArea: 2 * AreaFront + 2 * AreaSide + RidgeLength * thickness;
Squares: 100 sq ft;
PlywoodSheets: 4 ft * 8 ft;
edges: RidgeLength + 4 * HipLength;
shinglesForEdges: edges / (4 in) / 3;
 "Get the results"

RidgeLength; = 32 ft + in + 8 in/16
length_NR; ~ 12 ft + 6 in + 16.0 in/16
angleRafter; ~ 71.6 deg
HipLength; ~ 17 ft + 4 in + 2.2 in/16
HipAngle; ~ 76.7 deg
numberOfJackRafters; = 8
JRN: 1;
jackLenght; ~ 11 ft + 2 in + 9.5 in/16
JRN: 2;
jackLenght; ~ 9 ft + 9 in + 11.7 in/16
JRN: 3;
jackLenght; ~ 8 ft + 4 in + 13.8 in/16
JRN: 4;
jackLenght; ~ 6 ft + 11 in + 16.0 in/16
JRN: 5;
jackLenght; ~ 5 ft + 7 in + 2.2 in/16
JRN: 6;
jackLenght; ~ 4 ft + 2 in + 4.3 in/16
JRN: 7;
jackLenght; ~ 2 ft + 9 in + 6.5 in/16
JRN: 8;
jackLenght; ~ ft + 4 in + 8.6 in/16
RoofArea as Squares; ~ 14.2 Squares
RoofArea as PlywoodSheets; ~ 44.3 PlywoodSheets
shinglesForEdges; ~ 101.5
Example2: sideR: 24 ft; sideF: 56 ft; pitch: 6 in / ( 12 in ); TOP
 "Define the givens"

sideR: 24 ft;
sideF: 56 ft;
pitch: 6 in / ( 12 in );
 "Get the Results"

RidgeLength; = 32 ft + in + 8 in/16
length_NR; ~ 13 ft + 4 in + 2.5 in/16
angleRafter; ~ 63.4 deg
HipLength; = 17 ft + 10 in + 14 in/16
HipAngle; ~ 70.5 deg
numberOfJackRafters; = 8
JRN: 1;
jackLenght; ~ 11 ft + 10 in + 12.2 in/16
RoofArea as Squares; ~ 15.0 Squares
RoofArea as PlywoodSheets; ~ 46.9 PlywoodSheets
shinglesForEdges; = 103 + 3/4
Example3: sideR: 28 ft; sideF: 64 ft; pitch: 3 in / ( 12 in ); TOP
 "Define the givens"

sideR: 28 ft;
sideF: 64 ft;
pitch: 3 in / ( 12 in );
 "Get the Results"

RidgeLength; = 32 ft + in + 8 in/16
length_NR; ~ 13 ft + 4 in + 2.5 in/16
angleRafter; ~ 63.4 deg
HipLength; = 17 ft + 10 in + 14 in/16
HipAngle; ~ 70.5 deg
numberOfJackRafters; = 9
JRN: 1;
jackLenght; ~ 11 ft + 10 in + 12.2 in/16
RoofArea as Squares; ~ 15.0 Squares
RoofArea as PlywoodSheets; ~ 46.9 PlywoodSheets
shinglesForEdges; = 103 + 3/4
Your Own Calculations TOP
 Open UnitMath on your computer. If needed see downloads for Macintosh or Windows.
 Copy the following text into UnitMath.
" Define the Givens CHANGE THESE "
sideR: 24 ft;
sideF: 56 ft;
pitch: 4 in / ( 12 in );
" IN GENERAL DON'T CHANGE THESE  "
thickness: ( 1 + 1/2 ) inch "Standard 2 by X";
pitchAngle: atan( pitch );
Ty: (sideR  thickness) / 2; Tx: Ty; Tz: Ty tan( pitchAngle );
T: Tx `i + Ty `j + Tz `k;
HipLength: abs( T ) as ft & in & in/16;
RidgeLength: sideF  2 Tx as ft & in & in/16;
length_NR: sqrt(sq HipLength  sq Tx ) as ft & in & in/16;
angleRafter: 90 deg  pitchAngle as deg;
angleRafterGauge: 90 deg  angleRafter as deg;
angle_1: acos(Tx / HipLength );
C: 0 m `i + 0 m `j + m `k;
HipAngle: acos( T dot C / ( abs( T ) abs( C ) ) ) as deg;
HipAngleGauge: 90 deg  HipAngle as deg;
RafterSpacing: 16 inch;
Rx: Tx + thickness;
Jackx: Rx  JRN * RafterSpacing as ft & in & in/16;
Gx: thickness cos( 45 deg ) as in;
jackLenght: ( Jackx  Gx ) tan( angle_1 ) as ft & in & in/16;
numberOfJackRafters: ( Tx  ft ) / RafterSpacing  frac( ( Tx  ft ) / RafterSpacing );
AreaSide: Tx * length_NR + thickness * length_NR;
AreaFront: RidgeLength * length_NR + Tx * length_NR;
RoofArea: 2 * AreaFront + 2 * AreaSide + RidgeLength * thickness;
edges: RidgeLength + 4 * HipLength;
shinglesForEdges: edges / (4 in) / 3;
Squares: 100 sq ft;
PlywoodSheets: 4 ft * 8 ft;
" The Results will be here after the calculation "
RidgeLength;
length_NR;
angleRafter;
angleRafterGauge;
HipLength;
HipAngle;
HipAngleGauge;
numberOfJackRafters;
JRN: 1;
jackLenght;
JRN: 2;
jackLenght;
" Add more jack rafters as needed "
RoofArea as Squares;
RoofArea as PlywoodSheets;
shinglesForEdges;
" Stop Copying Here "
 Change the Givens
 For example:

sideR: 100 m;
sideF: 50 m;
pitch: 2 cm / ( 12 cm );
 Select all the text that you pasted in Step 2 and evaluate it.
Your results will be at the end of the text. Before building see
angle notes.
TOP