Trigonometry on site: slopes, pitches, rise and run
Sine, cosine and tangent on right-angled triangles; the four ways to write a slope; roof pitches, ramps and stairs; and checking a corner is square with the cosine rule.
Pythagoras, sine, cosine and tangent
| Relation | Formula | Use it when you know… |
|---|---|---|
static double Rad(double deg) => deg * Math.PI / 180; static double Rise(double run, double pitchDeg) => run * Math.Tan(Rad(pitchDeg));static double Rafter(double run, double pitchDeg) => run / Math.Cos(Rad(pitchDeg)); double run = 4.0, pitch = 30; // half the span of an 8 m roofConsole.WriteLine($"Rise: {Rise(run, pitch):F3} m");Console.WriteLine($"Rafter: {Rafter(run, pitch):F3} m");Rise: 2.309 m Rafter: 4.619 m
Four ways to write a slope
Angle in degrees, from the horizontal: “a 30° roof”. Ratio rise : run, usually with the rise as 1: “a 1:12 ramp” rises 1 for every 12 along. Percentage, rise ÷ run × 100: “a 2% fall” on a flat roof or a drain drops 2 cm per metre. Pitch in inches of rise per 12 inches of run, common for roofs in the US: “a 6 in 12 roof”.
static double PercentToDeg(double pct) => Math.Atan(pct / 100) * 180 / Math.PI;static double RatioToPercent(double rise, double run) => rise / run * 100; double ramp = RatioToPercent(1, 12);Console.WriteLine($"1:12 ramp = {ramp:F2}% = {PercentToDeg(ramp):F2} deg"); double roof = RatioToPercent(6, 12);Console.WriteLine($"6 in 12 roof = {roof:F2}% = {PercentToDeg(roof):F2} deg"); Console.WriteLine($"100% slope = {PercentToDeg(100):F2} deg");1:12 ramp = 8.33% = 4.76 deg 6 in 12 roof = 50.00% = 26.57 deg 100% slope = 45.00 deg
Is the corner square? The cosine rule
c² = a² + b² − 2ab·cos C, so C = Acos((a² + b² − c²) / (2ab)), where C is the angle opposite side c.
static double AngleDeg(double a, double b, double c) => Math.Acos((a * a + b * b - c * c) / (2 * a * b)) * 180 / Math.PI; Console.WriteLine($"{AngleDeg(6, 8, 10):F2}"); // perfect 6-8-10Console.WriteLine($"{AngleDeg(6, 8, 10.012):F2}"); // diagonal 12 mm long90.00 90.14
Show a hint
Math.Ceiling(3000 / 180.0). Riser height = 3000 / risers. Pitch = Atan(riser / going). Run = (risers − 1) × going.
Show the solution
double totalRise = 3000, maxRiser = 180, going = 250; int risers = (int)Math.Ceiling(totalRise / maxRiser);double riser = totalRise / risers;double pitch = Math.Atan(riser / going) * 180 / Math.PI;double run = (risers - 1) * going; Console.WriteLine($"{risers} risers of {riser:F1} mm");Console.WriteLine($"Going {going} mm, pitch {pitch:F1} deg");Console.WriteLine($"Horizontal run {run} mm");17 risers of 176.5 mm Going 250 mm, pitch 35.2 deg Horizontal run 4000 mm
Remember
Roofs, ramps and stairs are right-angled triangles: run, rise and the sloping side. tan θ = rise / run, cos θ = run / slope length, sin θ = rise / slope length. A slope can be an angle, a ratio (1:12), a percentage (rise ÷ run × 100) or a pitch (6 in 12); 100% is 45°. The cosine rule gives any angle of a triangle from its three sides, which is how site crews check corners are square.