/* 490-1 임시 횡단 판정 — 진짜 `logic/B05_Profile_Profile_CrossPick.ts` 를 Node 로 돌려 냄. * 입력 argv[2] JSON {samples, cases: [{hit, chainageM, pointerY}]} · groundY = 100 - 표고 × 2 px. * 짝 = test_490_1_cross_pick.py. */ const fs = require("fs"); const path = require("path"); const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript")); const file = path.join( __dirname, "..", "..", "B05_Profile", "logic", "B05_Profile_Profile_CrossPick.ts", ); const js = ts.transpileModule(fs.readFileSync(file, "utf8"), { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 }, }).outputText; const box = { exports: {} }; new Function("exports", "module", "require", js)(box.exports, box, require); const logic = box.exports; const job = JSON.parse(fs.readFileSync(process.argv[2], "utf8")); const groundY = (elevation) => 100 - elevation * 2; const out = job.cases.map((c) => ({ pick: logic.crossPickAt({ ...c, samples: job.samples, groundY }), ground: logic.groundElevationAt(job.samples, c.chainageM), })); process.stdout.write(JSON.stringify({ slack: logic.GROUND_SLACK_PX, out }));