1---
2app_version: 0.7.0
3precision: 2
4form_title: Roof pitch and rafters
5form_description: Pitch, span and overhang in — get the ridge height, rafter length, roof area and how many tiles to order. Or turn a slope in percent into degrees.
6form_inputs: Roof pitch|pitch{°}, Span (eaves to eaves)|span{m}, Overhang|overhang{m}, Length along the ridge|ridge{m}, Tiles per m²|per_m2, Slope in percent|slope{%}
7form_outputs: Ridge height|rise, Rafter length|rafter, Roof area|area, Tiles to order|tiles, Slope as an angle|angle
8---
9# Roof pitch and rafters
10// Angles carry their unit: tan(35°) works as written, and `in deg` turns
11// an angle in radians, like the result of atan, into degrees.
12// This notebook also has a FORM (Pro): Form → Form view for an input mask.
13
14# The roof
15pitch = 35°
16span = 8.4 m // eaves to eaves
17overhang = 0.4 m
18ridge = 12 m // length along the ridge
19
20# Rafters
21rise = span / 2 * tan(pitch)
22rafter = span / 2 / cos(pitch) + overhang
23area = 2 * rafter * ridge
24
25# Tiles
26per_m2 = 10 // from the tile's data sheet
27waste = 5%
28tiles = ceil(area / 1 m² * per_m2 * (1 + waste))
29
30# Slope given in percent
31slope = 45%
32angle = atan(slope) in deg
33