Files
Aislo/resources/tester/helper_139_6_pipe_fit.cjs
T
eomsangdonandClaude Opus 5.5 281c71b55b refactor(logic): 348-1 순수 계산 TS 49 파일 <페이지>/logic/ 로 옮김 — 이름 앞머리 그대로 · 동작 고침 없음
- 옮김: B04 2 · B05 23 · B06 11 · A00_Common/design 13 (9,299 줄) · 이미 logic/ 에 있던 16 파일 그대로
- 안 옮김: 묶음 입구(package.json build:*) · 파이썬 · 순수지만 계산 아닌 8 (보기 결선 · 콜백 · API 타입 · 갈아끼움 알림판)
- import 266 줄(142 파일) · 시험 · 주석 · 짝 표시 문자열 경로 고침 · B05 · B06 CLAUDE.md 짝 줄 logic/
- 시험 도우미 새 경로: 가짜 require 열쇠 · B05()/B06() 부름 · 형제 import 자리 · tsc 묶어 돌리는 시험 · 정규식 · rglob
- design_view_cross 줄 한도 시험 685 → 688 (긴 import 경로 줄바꿈 3줄)
- 확인: typecheck 0 · 서버 묶음 넷(corridor · server-calc · b07-extent · b07-note) 다시 지어 코드 같음(//#region 경로 주석만 다름) · 관련 시험 270 파일 — 남은 실패 19 는 옮기기 전과 같음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
2026-10-16 13:44:50 +09:00

79 lines
3.3 KiB
JavaScript

/* 139-6 노견을 넓힌 유출 쪽 관 길이 맞춤 헬퍼 — 설계선 엔진(`common_util_cross_design`)으로 노견 확장
* 설계를 내고 배수관 기하(`_Cross_Culvert_Geom`)를 돌림. 입력 = B07 픽스처 배관 측점(85.052 · 유출 좌).
* 표준단면 수치 = 인자 JSON 파일(파이썬 config 그대로 · 거울 시험과 같은 방식).
* 짝 = `test_139_6_pipe_fit.py`.
*/
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const ROOT = path.join(__dirname, "..", "..");
const cache = new Map();
const noop = new Proxy({}, { get: () => () => "" });
globalThis.document = { addEventListener: () => undefined };
function loadTs(file) {
const full = path.resolve(file);
if (cache.has(full)) return cache.get(full);
if (full.endsWith(".json")) return JSON.parse(fs.readFileSync(full, "utf8"));
const js = ts.transpileModule(fs.readFileSync(full, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
cache.set(full, box.exports);
const resolve = (base) =>
fs.existsSync(base) && fs.statSync(base).isFile() ? base : `${base}.ts`;
const req = (r) => {
if (r.startsWith("@ui/") || r.startsWith("@config/")) return noop;
if (r.startsWith("@util/")) return loadTs(resolve(path.join(ROOT, "common_util", r.slice(6))));
return loadTs(resolve(path.join(path.dirname(full), r)));
};
new Function("exports", "module", "require", js)(box.exports, box, req);
cache.set(full, box.exports);
return box.exports;
}
const { computeCrossDesign } = loadTs(
path.join(ROOT, "common_util", "common_util_cross_design.ts"),
);
const { computeCulvertLayout, REVET_EMBED_DEPTH_M } = loadTs(
path.join(ROOT, "B06_Section", "B06_Section_UI_Cross_Culvert_Geom.ts"),
);
const { cutLength } = loadTs(
path.join(ROOT, "B06_Section", "logic", "B06_Section_UI_Cross_Culvert_Solve.ts"),
);
const sections = JSON.parse(
fs.readFileSync(path.join(__dirname, "fixtures", "b07_cross_overlay_sections.json"), "utf8"),
).cross_sections;
const section = sections.find((s) => s.culvert && !s.culvert.hidden_pipe);
const d = section.design;
const standard = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
const designOf = (extendLeft) =>
computeCrossDesign(section.samples, d.design_elevation_m, {
groundType: d.ground_type,
sectionMode: d.section_mode,
ditchSide: d.ditch_side,
ditchType: d.ditch_type ?? "standard",
paved: !!d.paved,
standard,
shoulderExtendLeftM: extendLeft,
});
const r3 = (v) => Math.round(v * 1000) / 1000;
const run = (extendLeft) => {
const design = designOf(extendLeft);
const s = { ...section, design };
const layout = computeCulvertLayout(s, section.samples, undefined, "L");
const wall = layout.walls.find((w) => w.role === "outlet");
const edge = design.road_edges.left;
return {
edge: r3(edge.offset_m),
extend: design.shoulder_extend_left_m ?? 0,
pureHeight: r3(wall.height + REVET_EMBED_DEPTH_M),
lengthM: layout.pipe.lengthM,
cut: r3(cutLength(layout.pipeCorners)),
slope: r3(layout.fillSlope.ratio),
};
};
process.stdout.write(JSON.stringify({ base: run(0), shifted: run(1.0), shifted2: run(1.3) }));