{
  "schemaVersion": 1,
  "slug": "tree-planting-distance-calculator",
  "category": "gardening",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "93dee77d3a6c27cb0f2af7f289f47d38871d5e71fa06c9d0b8c262ac7fe2689c",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/tree-planting-distance-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": "S = 0.8H; C = 0.35Hh; R = 0.5Hh; D = Rr",
    "vars": [
      [
        "H",
        "Mature height"
      ],
      [
        "h",
        "Root-habit factor"
      ],
      [
        "r",
        "Nearby-feature factor"
      ],
      [
        "S",
        "Illustrative canopy spread"
      ],
      [
        "C",
        "Illustrative canopy distance"
      ],
      [
        "R",
        "Illustrative root distance"
      ],
      [
        "D",
        "Illustrative starting distance"
      ]
    ],
    "note": "Illustrative multipliers only; this does not calculate overhead-line clearance. Confirm species mature spread, underground utility locations, and local/provider clearance requirements before planting."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const H={columnar:0.4,moderate:0.8,aggressive:1.2,willow:1.6};const R={house:1.6,wall:1.2,sewer:1.8,driveway:1.3,boundary:0.9};const spread=matureHeight*0.8;const habit=H[rootHabit]||0.8;const canopyDistance=matureHeight*0.35*habit;const rootDistance=matureHeight*0.5*habit;const recommended=rootDistance*(R[feature]||1);return {matureSpread:spread,canopyDistance,rootDistance,recommended};",
    "inputs": [
      {
        "name": "matureHeight",
        "type": "number",
        "default": 40,
        "min": 2,
        "max": 200,
        "step": 1,
        "slider": true
      },
      {
        "name": "rootHabit",
        "type": "select",
        "default": "moderate",
        "options": [
          {
            "value": "columnar"
          },
          {
            "value": "moderate"
          },
          {
            "value": "aggressive"
          },
          {
            "value": "willow"
          }
        ]
      },
      {
        "name": "feature",
        "type": "select",
        "default": "house",
        "options": [
          {
            "value": "house"
          },
          {
            "value": "wall"
          },
          {
            "value": "sewer"
          },
          {
            "value": "driveway"
          },
          {
            "value": "boundary"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "matureSpread",
        "precision": 1,
        "unit": "ft"
      },
      {
        "name": "canopyDistance",
        "precision": 1,
        "unit": "ft"
      },
      {
        "name": "rootDistance",
        "precision": 1,
        "unit": "ft"
      },
      {
        "name": "recommended",
        "precision": 1,
        "unit": "ft"
      }
    ],
    "interpret": null
  }
}
