Trust / Method contract

Calculation Methodology

RoofFigured uses deterministic right-triangle geometry, exact unit factors and full internal precision. The calculation version is rgw-core 0.2.0, reviewed 4 September 2026.

Core formulas

Pitch ratio = rise ÷ run. Angle = atan(ratio) in degrees. Percentage slope = 100 × ratio. Slope multiplier = √(1 + ratio²). Sloping length = horizontal run × multiplier. Compatible planar surface area = horizontal plan area × multiplier.

The engine validates finite values, requires positive run, rejects negative dimensions and prevents overflow. It rounds only when formatting a displayed result.

Units and tolerance

Exact factors include 1 inch = 0.0254 metre, 1 foot = 0.3048 metre and 1 square foot = 0.09290304 square metre. Locale decimal commas are accepted when the number is unambiguous.

Round-trip representation tests use documented tolerances. Display precision is not a claim about source measurement accuracy.

Validation and change control

Automated fixtures cover flat, 6/12, 12/12, metric equivalence, rafter and area cases plus invalid and extreme states. An independent implementation cross-checks representative outputs.

A material formula change requires a version change, fixture rerun, independent comparison and published change-log entry.

These calculations describe geometry only. They do not size rafters or trusses, assess loads, approve a design, interpret building codes, specify cuts or fasteners, or guarantee material quantities.

Formula and variable register

OutputFormulaVariables and range
Pitch ratioq = rise ÷ runrise ≥ 0; run > 0
Rise per 1212qq finite and non-negative
Angleatan(q) × 180 ÷ π0° ≤ angle < 90°
Percentage100qnon-negative
Factor√(1 + q²)factor ≥ 1
Slope linehorizontal run × factorpositive adjusted run
Sloping areacompatible plan area × factorpositive supported area
Material unitsceil(area × (1 + waste/100) ÷ coverage)area, coverage > 0; waste ≥ 0

Calculations use JavaScript double precision and exact unit constants: 1 in = 0.0254 m, 1 ft = 0.3048 m and 1 ft² = 0.09290304 m². Conversion occurs before state is redisplayed; visible rounding does not alter the stored calculation.

Error handling, validation and version control

Required values are parsed as finite numbers. The engine rejects blank fields, ambiguous separators, negative geometry, zero run, invalid hypotenuse pairs, angles outside the open 0–90° range for angle pairs, and deductions that remove the adjusted run. Invalid sections remain identifiable and are excluded from aggregate results.

Every material formula change requires a version increment, a representative fixture, a failure-state regression, an independent mathematical reproduction and a dated change-log entry. Supported geometry remains right triangles and supplied compatible simple-plane plan areas; no spatial inference is performed for hips, valleys, dormers, curves or intersections.

Reviewed 4 September 2026Calculation version rgw-core 0.2.0