{
  "schemaVersion": 1,
  "slug": "circle-skirt-calculator",
  "category": "diy-craft",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "f0133d5d7e1fed72a5d6b0eb4e55fb66ae2942b236c91743c8a014b93caaf2e3",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/circle-skirt-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": "r = w ÷ (2πf); R = r + L + h; Y = ⌈4f ÷ ⌊W ÷ R⌋⌉ × R ÷ 36",
    "vars": [
      [
        "r",
        "Waist radius (in)"
      ],
      [
        "w",
        "Waist circumference (in)"
      ],
      [
        "f",
        "Circle fraction"
      ],
      [
        "R",
        "Outer radius (in)"
      ],
      [
        "L",
        "Skirt length (in)"
      ],
      [
        "h",
        "Hem allowance (in)"
      ],
      [
        "W",
        "Fabric width (in)"
      ],
      [
        "Y",
        "Fabric length (yd)"
      ]
    ],
    "note": "All lengths are converted to inches. Fabric is estimated as separate quarter-circle panels. If a panel does not fit the fabric width, no yardage is given."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const k = unit === 'cm' ? 1/2.54 : 1; const w=waist*k, L=length*k, width=fabricWidth*k, hem=hemAllowance*k; const fraction = fullness === 'full' ? 1 : fullness === 'threequarter' ? 0.75 : fullness === 'half' ? 0.5 : 0.25; const radius = w/(2*Math.PI*fraction); const total = radius+L+hem; const panels = Math.round(fraction*4); const columns = Math.floor(width/total); const yardage = columns >= 1 ? Math.ceil(panels/columns)*total/36 : null; return { waistRadius: radius, totalRadius: total, fabricRequired: total, yardage, waistCircumference: w, diameter: total*2, layoutNote: columns >= 1 ? 'Quarter-panel layout estimate; allow extra for seams and pattern matching' : 'Fabric is too narrow for the quarter-panel layout' };",
    "inputs": [
      {
        "name": "waist",
        "type": "number",
        "default": 28,
        "min": 15,
        "max": 220,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "unit",
        "type": "select",
        "default": "in",
        "options": [
          {
            "value": "in"
          },
          {
            "value": "cm"
          }
        ]
      },
      {
        "name": "length",
        "type": "number",
        "default": 24,
        "min": 5,
        "max": 160,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "fullness",
        "type": "select",
        "default": "full",
        "options": [
          {
            "value": "full"
          },
          {
            "value": "threequarter"
          },
          {
            "value": "half"
          },
          {
            "value": "quarter"
          }
        ]
      },
      {
        "name": "fabricWidth",
        "type": "number",
        "default": 45,
        "min": 20,
        "max": 320,
        "step": 1,
        "slider": true
      },
      {
        "name": "hemAllowance",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 25,
        "step": 0.25,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "waistRadius",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "totalRadius",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "fabricRequired",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "yardage",
        "precision": 2,
        "unit": "yards",
        "optional": true
      },
      {
        "name": "waistCircumference",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "diameter",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "layoutNote",
        "type": "text",
        "unit": ""
      }
    ],
    "interpret": null
  }
}
