{
  "schemaVersion": 1,
  "slug": "balloon-arch-calculator",
  "category": "party",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "e68fe4a1defcd67f1eb3ccfed67ce54d909e160c0f233d8afed6168bd0cc3306",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/balloon-arch-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": "L = π(3(a+b) − √((3a+b)(a+3b))) ÷ 2 ÷ 0.98; N = ⌈L ÷ (d × ρ)⌉",
    "vars": [
      [
        "a",
        "Half span, width ÷ 2"
      ],
      [
        "b",
        "Arch height"
      ],
      [
        "L",
        "Garland length"
      ],
      [
        "d",
        "Balloon diameter"
      ],
      [
        "ρ",
        "Packing density"
      ],
      [
        "N",
        "Balloons needed"
      ]
    ],
    "note": "Ramanujan approximation for the half-ellipse perimeter; d = size ÷ 12 ft; ρ = 0.9 classic, 0.78 organic."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "Wolfram MathWorld — Ellipse perimeter approximation",
        "url": "https://mathworld.wolfram.com/Ellipse.html"
      }
    ],
    "referenceRole": "definition",
    "implementationHash": "e68fe4a1defcd67f1eb3ccfed67ce54d909e160c0f233d8afed6168bd0cc3306",
    "basis": "L = π(3(a+b) − √((3a+b)(a+3b))) ÷ 2 ÷ 0.98; N = ⌈L ÷ (d × ρ)⌉",
    "limitations": "The references explain definitions and methods; any extra preset must be checked against the assumptions on this page."
  },
  "contract": {
    "compute": "const a = width/2; const b = height; const full = Math.PI*(3*(a+b) - Math.sqrt((3*a + b)*(a + 3*b))); const garland = (full/2)/0.98; const dia = balloonSize/12; const density = style === 'organic' ? 0.78 : 0.9; const balloons = Math.ceil(garland/(dia*density)); return { garlandLength: garland, balloons: balloons, clusters: Math.ceil(balloons/4), balloonsWithSpares: Math.ceil(balloons*1.1), archSpan: width };",
    "inputs": [
      {
        "name": "width",
        "type": "number",
        "default": 8,
        "min": 1,
        "max": 40,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "height",
        "type": "number",
        "default": 7,
        "min": 1,
        "max": 20,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "balloonSize",
        "type": "select",
        "default": 11,
        "options": [
          {
            "value": 5
          },
          {
            "value": 9
          },
          {
            "value": 11
          },
          {
            "value": 12
          },
          {
            "value": 16
          }
        ]
      },
      {
        "name": "style",
        "type": "select",
        "default": "organic",
        "options": [
          {
            "value": "classic"
          },
          {
            "value": "organic"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "garlandLength",
        "precision": 1,
        "unit": "ft"
      },
      {
        "name": "balloons",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "clusters",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "balloonsWithSpares",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "archSpan",
        "precision": 1,
        "unit": "ft"
      }
    ],
    "interpret": null
  }
}
