Files
Aislo/resources/tester/helper_139_6_pipe_fit.cjs
T
eomsangdonandClaude Opus 5.5 e4befd158a refactor(472-3 B06 구조물): 관 · BOX · 세월교 · 물넘이 모양 계산을 logic 으로 옮김(518-2)
- logic 새 파일 9 — B06_Section_Cross_Culvert · _Culvert_Geom · _Culvert_Extra · _Culvert_Tiers ·
  _Culvert_Types · _Culvert_Wire · _Box_Geom · _Ford_Geom · _Ford_Pavement
- 그림 파일(UI_Cross_Culvert · _Culvert_Types · _Box · _Ford · _Ford_Pavement)은 받은 좌표로 그리기만 ·
  관 겹 꼭짓점(pipeShellCorners) · 물넘이 노면 끝 · 월류선 · 유출 성토선은 logic 으로
- 옛 순수 기하 6 파일(UI_Cross_Culvert_Geom · _Extra · _Tiers · _Wire · _Box_Geom · _Ford_Geom) 지움 ·
  부르는 쪽(B05 Corridor · Structure_Layouts · Route_Carry_Patch · Wall 등)은 import 줄만
- test_472_3 GEOMETRY_PULLS 자기 11 줄 + 더는 안 끌리는 Design_Surface 1 줄 걷음
- 시험 · helper 경로를 새 logic 파일로 — 옮긴 파일을 가리키던 낡은 경로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:17:23 +09:00

72 lines
2.8 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 { makeLoader } = require("./helper_ts_stub_loader.cjs");
const ROOT = path.join(__dirname, "..", "..");
const noop = new Proxy({}, { get: () => () => "" });
globalThis.document = { addEventListener: () => undefined };
const { loadTs } = makeLoader({
root: ROOT,
requireFor: (full) => {
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)));
};
return req;
},
});
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", "logic/B06_Section_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) }));