diff --git a/src/main.ts b/src/main.ts index cfa7968..9d8cea8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -687,13 +687,14 @@ function setupScene(): void { state.scene = scene; setView(state.view); } - // ③ 교대 (2026-11-04): with the piers hidden, the selected abutment's 저판 · 벽체 rebar is the ③ rebar (표 · 3D 선택 공통). + // ③ 교대 (2026-11-04): with the piers hidden, the selected abutment's 저판 · 벽체 · 흉벽 rebar is the ③ rebar (표 · 3D 선택 공통). const abutRec = piersShown(state.stage, state.abutActive) ? undefined : state.abutments.find((a) => a.name === state.abutActive); const abutGroup = abutRec ? abutGroupByName.get(abutRec.name) : undefined; const footing = abutRec ? abutFootingBuilt(abutRec) : null; if (abutRec && abutGroup && footing && footing.bottomEl !== undefined) { const wall = abutWallBuilt(abutRec, footing.result); - rebar3d = buildAbutRebar3D(footing.geom, footing.result, footing.skewK, footing.backM, footing.bottomEl, wall?.result); + const para = wall ? abutParapetBuilt(abutRec, wall) : null; + rebar3d = buildAbutRebar3D(footing.geom, footing.result, footing.skewK, footing.backM, footing.bottomEl, wall?.result, para?.result); rebar3d.group.applyMatrix4(abutGroup.matrix); rebar3d.group.visible = state.stage === 'rebar'; rebar3d.setColorMode(state.rebarColor); diff --git a/src/view/abut-rebar3d.ts b/src/view/abut-rebar3d.ts index e96ea71..8589902 100644 --- a/src/view/abut-rebar3d.ts +++ b/src/view/abut-rebar3d.ts @@ -1,6 +1,6 @@ /** - * 교대 3D 철근 (③, 2026-11-04): 저판 B1–B10과 벽체 W1–W11. Positions come from `abutFootingRebar` · `abutWallRebar` - * (no new rules here; the 벽체 bars are its paths). The 저판 shapes follow the + * 교대 3D 철근 (③, 2026-11-04): 저판 B1–B10, 벽체 W1–W11, 흉벽 · 브라켓 P1–P11. Positions come from `abutFootingRebar` · + * `abutWallRebar` · `abutParapetRebar` (no new rules here; the 벽체 · 흉벽 bars are their paths). The 저판 shapes follow the * 배근 삽도 (abut-footing-rebar-svg.ts): B1 ⊓ / B2 ⊔ / B3 · B4 직선, B5 ⊓ / B6 ⊔ / B7 · B8 직선, B9 연직, B10 측면, B1-S · B2-S. * Hooks and the bend radii are not drawn. Each bar is named by its 철근표 number, so the table, the 삽도 and the model * share one selection. Local frame = the abutment group's (x = s along the axis, y = EL, z = t toward the front). @@ -10,6 +10,8 @@ import type { AbutFootingGeom, AbutFootingRebar } from '../core/abut/rebar/footi import { NOMINAL_DIAMETER } from '../core/rebar/common'; import { memberOfBar } from '../core/rebar/color'; import { ABUT_WALL_SIZES, type AbutWallRebar } from '../core/abut/rebar/wall'; +import { ABUT_PARAPET_SIZES, type AbutParapetRebar } from '../core/abut/rebar/parapet'; +import { ABUT_PARAPET_COLORS } from './abut-parapet-rebar-svg'; import { ABUT_FOOTING_COLORS } from './abut-footing-rebar-svg'; import { ABUT_WALL_COLORS } from './abut-wall-rebar-svg'; import { rebarColor, rebarControls, type RebarScene } from './rebar3d'; @@ -18,14 +20,14 @@ type P3 = [number, number, number]; /** * @param skewK plan skew (s per m of t, `abutSkewK`), @param backM 저판 배면 t (m), @param bottomEl 기초 하단 EL (m), - * @param wall 벽체 배근 (없으면 저판만). + * @param wall 벽체 배근, @param parapet 흉벽 배근 (없으면 그 부재는 그리지 않음). */ -export function buildAbutRebar3D(g: AbutFootingGeom, r: AbutFootingRebar, skewK: number, backM: number, bottomEl: number, wall?: AbutWallRebar): RebarScene { +export function buildAbutRebar3D(g: AbutFootingGeom, r: AbutFootingRebar, skewK: number, backM: number, bottomEl: number, wall?: AbutWallRebar, parapet?: AbutParapetRebar): RebarScene { const group = new THREE.Group(); group.name = 'abut-rebar'; const byName = new Map(); const C = Object.fromEntries(Object.entries(ABUT_FOOTING_COLORS).map(([k, v]) => [k, parseInt(v.slice(1), 16)])) as Record; - const sizeOf = new Map([...r.bars.map((b) => [b.mark, b.size] as const), ...Object.entries(ABUT_WALL_SIZES)]); + const sizeOf = new Map([...r.bars.map((b) => [b.mark, b.size] as const), ...Object.entries(ABUT_WALL_SIZES), ...Object.entries(ABUT_PARAPET_SIZES)]); // (s, x, z) in mm: s along the skew grid (끝면과 나란히), x from the 배면, z from the 저판 하면. const P = (s: number, x: number, z: number): P3 => [s / 1000 + skewK * (backM + x / 1000), bottomEl + z / 1000, backM + x / 1000]; // Option ②: square to the axis, s in the 삽도's frame (abutFootingRebarPlanSvg SQ), the same for every x. @@ -100,12 +102,19 @@ export function buildAbutRebar3D(g: AbutFootingGeom, r: AbutFootingRebar, skewK: for (const x of [depth1, g.W - depth1]) add('B10-1', [P(e2, x, z1), P(g.L - e2, x, z1)], C.side); for (const s of [e2, g.L - e2]) add('B10-2', [P(s, depth1, z), P(s, g.W - depth1, z)], C.side); } - // 벽체: the rule paths in (u, t, z) mm — u on the skew grid, t from the axis, z from the 저판 하면. + // 벽체 · 흉벽: the rule paths in (u, t, z) mm — u on the skew grid, t from the axis, z from the 저판 하면. + const toScene = ([u, t, z]: [number, number, number]): P3 => [u / 1000 + (skewK * t) / 1000, bottomEl + z / 1000, t / 1000]; if (wall) { const W = Object.fromEntries(Object.entries(ABUT_WALL_COLORS).map(([k, v]) => [k, parseInt(v.slice(1), 16)])) as Record; const colorOf = (mark: string) => ['W1', 'W3', 'W4', 'W11'].includes(mark) ? W.vertical : mark === 'W7' ? W.tie : mark === 'W9' || mark === 'W10' ? W.step : W.horizontal; - for (const p of wall.paths) add(p.mark, p.pts.map(([u, t, z]): P3 => [u / 1000 + (skewK * t) / 1000, bottomEl + z / 1000, t / 1000]), colorOf(p.mark)); + for (const p of wall.paths) add(p.mark, p.pts.map(toScene), colorOf(p.mark)); + } + if (parapet) { + const P = Object.fromEntries(Object.entries(ABUT_PARAPET_COLORS).map(([k, v]) => [k, parseInt(v.slice(1), 16)])) as Record; + const colorOf = (mark: string) => + ['P1', 'P2', 'P3', 'P11'].includes(mark) ? P.vertical : mark === 'P6' || mark === 'P7' ? P.tie : ['P8', 'P9', 'P10'].includes(mark) ? P.side : P.horizontal; + for (const p of parapet.paths) add(p.mark, p.pts.map(toScene), colorOf(p.mark)); } return { group, byName, records: [], ...rebarControls(byName) }; } diff --git a/tests/abut-rebar3d.test.ts b/tests/abut-rebar3d.test.ts index e204740..07d42e0 100644 --- a/tests/abut-rebar3d.test.ts +++ b/tests/abut-rebar3d.test.ts @@ -11,6 +11,7 @@ import { skewAngle } from '../src/core/abut/rebar/skew-layout'; import { abutSkewK } from '../src/view/abut-scene'; import { buildAbutRebar3D } from '../src/view/abut-rebar3d'; import { abutWallGeom, abutWallRebar } from '../src/core/abut/rebar/wall'; +import { abutParapetGeom, abutParapetRebar } from '../src/core/abut/rebar/parapet'; // 예제 A1 (교대확대기초철근.md §13). const RAG = fileURLToPath(new URL('../../../RAG/운곡교P1입력.xlsx', import.meta.url)); @@ -98,3 +99,35 @@ describe('교대 벽체 3D 철근 (③, 2026-11-04)', () => { } }); }); + +describe('교대 흉벽 · 브라켓 3D 철근 (③, 2026-11-04)', () => { + const footing = abutFootingRebar(geom); + const wGeom = abutWallGeom(model.length, members, skewAngle(rec.skewDeg)); + const wall = abutWallRebar(wGeom, footing); + const pGeom = abutParapetGeom(wGeom, members.shape, { B: 11254, a: 300, b: 11554, nearT: -505, chamferA: 300, chamferB: 300 }); + const para = abutParapetRebar(pGeom, wall); + const scene = buildAbutRebar3D(geom, footing, k, back, bottom, wall, para); + + it('draws every 흉벽 bar of the 철근표 (one tube per straight piece), next to the 저판 · 벽체 bars', () => { + for (const b of para.bars) { + const pieces = para.paths.filter((p) => p.mark === b.mark).reduce((a, p) => a + p.pts.length - 1, 0); + expect(scene.byName.get(b.mark)?.length, b.mark).toBe(pieces); + } + expect(scene.byName.get('W1')?.length).toBeGreaterThan(0); + expect(scene.byName.get('B1')?.length).toBeGreaterThan(0); + }); + + it('keeps the 흉벽 bars between the bracket back and the 흉벽 전면, below the 흉벽 상단 (P10 into the slab by 300)', () => { + const topMax = bottom + Math.max(...pGeom.top) / 1000; + const box = new THREE.Box3(); + for (const b of para.bars) { + for (const mesh of scene.byName.get(b.mark)!) { + mesh.geometry.computeBoundingBox(); + box.copy(mesh.geometry.boundingBox!); + expect(box.min.z, b.mark).toBeGreaterThan(wGeom.xb / 1000); + expect(box.max.z, b.mark).toBeLessThan(0); + expect(box.max.y, b.mark).toBeLessThan(topMax + (b.mark === 'P10' ? 0 : -0.05)); + } + } + }); +});