{
  "schemaVersion": 1,
  "slug": "slope-grade-calculator",
  "category": "construction",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "48df8b24064da11aba9a36ad3f57a7bb86fbe2d39f462da5a605dc9f8195a3b8",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/slope-grade-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": "G = R÷(12r)×100; θ = atan2(R, 12r)×180÷π; q = R÷r; ratio = 1:(100÷G)",
    "vars": [
      [
        "R",
        "Rise (in)"
      ],
      [
        "r",
        "Horizontal run (ft)"
      ],
      [
        "G",
        "Slope grade (%)"
      ],
      [
        "θ",
        "Slope angle (°)"
      ],
      [
        "q",
        "Rise per foot (in/ft)"
      ],
      [
        "ratio",
        "Slope ratio (vertical:horizontal)"
      ]
    ],
    "note": "Slope (%) = rise ÷ horizontal run × 100; angle = arctan(rise/run). This is geometric conversion only, not a safety or code-compliance assessment."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const runIn = run*12; const pct = rise/runIn*100; return { slopePct:pct, angle:Math.atan2(rise,runIn)*180/Math.PI, ratio:'1:'+(pct>0?(100/pct).toFixed(1):'∞')+' (vertical:horizontal)', perFoot:rise/run };",
    "inputs": [
      {
        "name": "rise",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 240,
        "step": 0.125,
        "slider": true
      },
      {
        "name": "run",
        "type": "number",
        "default": 10,
        "min": 0.1,
        "max": 5000,
        "step": 0.5
      }
    ],
    "outputs": [
      {
        "name": "slopePct",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "angle",
        "precision": 2,
        "unit": "°"
      },
      {
        "name": "ratio",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "perFoot",
        "precision": 3,
        "unit": "in/ft"
      }
    ],
    "interpret": null
  }
}
