- 판정 셈을 logic/B05_Profile_Profile_CrossPick.ts 한 함수(crossPickAt)로 뺌 — 누름 · 표시가 같은 판정 - 원지반선 위아래 8 px · 추가 측점 선 = 그 측점 · 측점선 · 단추 · 도구 중 · 끌기 · 스크롤 = 안 그림 - 포인터 이동 소수 px 를 누름과 같이 내려 맞춤 — 0.5 m 경계 1 m 어긋남 막음 - 시험 test_490_1_cross_pick · test_368_3 연결 자리 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
/* 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 }));
|