{
  "schemaVersion": 1,
  "slug": "cross-stitch-calculator",
  "category": "diy-craft",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "bd115401899f5a5d935a2a71990e05b1ac3173ae02bb69440928782df1438fd5",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/cross-stitch-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": "Wd = D_w ÷ (C ÷ k);  S = D_w × D_h",
    "vars": [
      [
        "D_w",
        "Design width (stitches)"
      ],
      [
        "D_h",
        "Design height (stitches)"
      ],
      [
        "C",
        "Fabric count (stitches/in)"
      ],
      [
        "k",
        "1, or 2 over two threads"
      ],
      [
        "m",
        "Margin per side (in)"
      ]
    ],
    "note": "Design size = stitch count ÷ effective fabric count (C ÷ k). Cut size = design size + 2 × margin. Thread quantity is not estimated."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "DMC — Cross-stitch fabric and stitch-count guidance",
        "url": "https://www.dmc.com/GP/en-GB/products/aida-embroidery-fabric"
      }
    ],
    "referenceRole": "input",
    "implementationHash": "bd115401899f5a5d935a2a71990e05b1ac3173ae02bb69440928782df1438fd5",
    "basis": "Wd = D_w ÷ (C ÷ k);  S = D_w × D_h",
    "limitations": "Use the cited guidance and your own measurements, bills or product specifications to choose inputs. Sample defaults are not current local data."
  },
  "contract": {
    "compute": "const factor = overTwo === 'yes' ? 2 : 1; const perInch = fabricCount/factor; const w = designWidth/perInch; const h = designHeight/perInch; const stitches = designWidth*designHeight; return { designSizeWidth: w, designSizeHeight: h, fabricWidth: w + margin*2, fabricHeight: h + margin*2, totalStitches: stitches };",
    "inputs": [
      {
        "name": "designWidth",
        "type": "number",
        "default": 140,
        "min": 1,
        "max": 1000,
        "step": 1,
        "slider": true
      },
      {
        "name": "designHeight",
        "type": "number",
        "default": 100,
        "min": 1,
        "max": 1000,
        "step": 1,
        "slider": true
      },
      {
        "name": "fabricCount",
        "type": "select",
        "default": 14,
        "options": [
          {
            "value": 11
          },
          {
            "value": 14
          },
          {
            "value": 16
          },
          {
            "value": 18
          },
          {
            "value": 25
          },
          {
            "value": 28
          }
        ]
      },
      {
        "name": "overTwo",
        "type": "select",
        "default": "no",
        "options": [
          {
            "value": "no"
          },
          {
            "value": "yes"
          }
        ]
      },
      {
        "name": "margin",
        "type": "number",
        "default": 3,
        "min": 0,
        "max": 12,
        "step": 0.5,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "designSizeWidth",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "designSizeHeight",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "fabricWidth",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "fabricHeight",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "totalStitches",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
