{
  "schemaVersion": 1,
  "slug": "projector-distance-calculator",
  "category": "photography",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "aa1b0ce97289ae2b34bcf84f1dcd5f18bd9ea41e761cbefcc66c5db51d5c79c9",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/projector-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": "D = R × W; H = W ÷ a; diag = √(W² + H²); Wmax = (L × 12) ÷ R",
    "vars": [
      [
        "R",
        "Throw ratio"
      ],
      [
        "W",
        "Screen width (in)"
      ],
      [
        "a",
        "Aspect ratio"
      ],
      [
        "H",
        "Screen height (in)"
      ],
      [
        "D",
        "Throw distance"
      ],
      [
        "Wmax",
        "Maximum width fitting the room"
      ],
      [
        "diag",
        "Diagonal (in)"
      ],
      [
        "L",
        "Room length (ft)"
      ]
    ],
    "note": "D = throw ratio × screen width; room-limited width = (room length × 12) ÷ ratio. Assumes a single entered ratio and screen-to-lens distance; zoom, lens offset/shift, mounting clearance and model limits are excluded."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const distanceIn = throwRatio*screenWidth; const height = screenWidth/aspect; const diag = Math.sqrt(screenWidth*screenWidth + height*height); const roomIn = roomLength*12; const maxW = throwRatio > 0 ? roomIn/throwRatio : 0; return { throwDistance: distanceIn/12, screenHeight: height, screenDiagonal: diag, screenArea: screenWidth*height/144, maxScreenForRoom: maxW, roomFits: roomIn >= distanceIn ? 'Yes — with ' + Math.round((roomIn - distanceIn)/12*10)/10 + ' ft to spare' : 'No — short by ' + Math.round((distanceIn - roomIn)/12*10)/10 + ' ft' };",
    "inputs": [
      {
        "name": "throwRatio",
        "type": "number",
        "default": 1.5,
        "min": 0.2,
        "max": 10,
        "step": 0.01,
        "slider": true
      },
      {
        "name": "screenWidth",
        "type": "number",
        "default": 100,
        "min": 1,
        "max": 2000,
        "step": 1,
        "slider": true
      },
      {
        "name": "aspect",
        "type": "select",
        "default": 1.7778,
        "options": [
          {
            "value": 1.7778
          },
          {
            "value": 2.35
          },
          {
            "value": 1.3333
          },
          {
            "value": 1.6
          }
        ]
      },
      {
        "name": "roomLength",
        "type": "number",
        "default": 15,
        "min": 1,
        "max": 200,
        "step": 0.5,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "throwDistance",
        "precision": 2,
        "unit": "ft"
      },
      {
        "name": "screenHeight",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "screenDiagonal",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "screenArea",
        "precision": 2,
        "unit": "sq ft"
      },
      {
        "name": "maxScreenForRoom",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "roomFits",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
