{
  "schemaVersion": 1,
  "slug": "roof-pitch-calculator",
  "category": "construction",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "554a9fb05397268f0e87bd3ed05b5c9ab9460da114c6963a10d98971846f16bd",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/roof-pitch-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "P = 12r ÷ u; ang = atan(r ÷ u) × 180 ÷ π; L = √(r² + u²)",
    "vars": [
      [
        "r",
        "Rise (in)"
      ],
      [
        "u",
        "Run (in)"
      ],
      [
        "P",
        "Pitch per 12 in run"
      ],
      [
        "ang",
        "Roof angle (degrees)"
      ],
      [
        "L",
        "Rafter length over run"
      ]
    ],
    "note": "This calculator reports rise/run geometry only. Pitch = rise ÷ run × 12; slope percent = rise ÷ run × 100; rafter length = run × √(rise² + run²) ÷ run. Material suitability and installation requirements depend on local rules and the selected product."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "OpenStax — Pythagorean theorem and right triangles",
        "url": "https://openstax.org/books/prealgebra-2e/pages/9-3-use-properties-of-angles-triangles-and-the-pythagorean-theorem"
      }
    ],
    "referenceRole": "definition",
    "implementationHash": "554a9fb05397268f0e87bd3ed05b5c9ab9460da114c6963a10d98971846f16bd",
    "basis": "P = 12r ÷ u; ang = atan(r ÷ u) × 180 ÷ π; L = √(r² + u²)",
    "limitations": "The references explain definitions and methods; any extra preset must be checked against the assumptions on this page."
  },
  "contract": {
    "compute": "const pitch = rise/run*12; const angle = Math.atan(rise/run)*180/Math.PI; const multiplier = Math.sqrt(Math.pow(rise, 2)+Math.pow(run, 2))/run; return { pitch, angle, slopePct: rise/run*100, multiplier, rafterLength: run*multiplier };",
    "inputs": [
      {
        "name": "rise",
        "type": "number",
        "default": 6,
        "min": 0,
        "max": 120,
        "step": 0.25,
        "slider": true
      },
      {
        "name": "run",
        "type": "number",
        "default": 12,
        "min": 0.5,
        "max": 240,
        "step": 0.25,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "pitch",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "angle",
        "precision": 2,
        "unit": "°"
      },
      {
        "name": "slopePct",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "multiplier",
        "precision": 4,
        "unit": ""
      },
      {
        "name": "rafterLength",
        "precision": 2,
        "unit": "in"
      }
    ],
    "interpret": null
  }
}
