From 2f67efd449a443ddf4b192e8434d07cc32ce9b5b Mon Sep 17 00:00:00 2001 From: ypshim Date: Mon, 26 Oct 2026 13:17:50 +0900 Subject: [PATCH] =?UTF-8?q?fix(bearing):=20C4=20and=20C5=20are=20the=20?= =?UTF-8?q?=EA=B5=90=EA=B0=81=EC=B6=95=20distances=20from=20the=20bearing?= =?UTF-8?q?=20to=20the=20block=20edges=20(=EC=8A=B9=EC=9D=B8=202026-10-26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - bearingEdgeDistances measures along the 교각축: 분리 600 / 600; 일체 from the pair block centred on the mean 교각축 position (P1 outer margins 557). - Table headings updated; C1 · C2 · C3 on the plan are measured on the 교축 from the drawn positions. Co-Authored-By: Claude Haiku 5.5 --- src/core/bearing-layout.ts | 35 +++++++++++++---------------------- src/main.ts | 5 ++--- src/view/bearing-plan-svg.ts | 9 +++++---- tests/bearing-layout.test.ts | 18 +++++++++++------- 4 files changed, 31 insertions(+), 36 deletions(-) diff --git a/src/core/bearing-layout.ts b/src/core/bearing-layout.ts index 4b0d94a..566d742 100644 --- a/src/core/bearing-layout.ts +++ b/src/core/bearing-layout.ts @@ -2,7 +2,7 @@ import type { BlockModel, PierModel } from './geometry'; /** * 받침 배치 규칙 (승인 2026-10-26). - * - C4·C5: 교축 방향, 받침 중심과 받침블럭 연단 사이 거리 (승인 2026-10-26). 블록 형상에서 계산하고 도면값과 비교한다. + * - C4·C5: 교각축 방향, 받침 중심과 받침블럭 연단 사이 거리 (승인 2026-10-26, 교각축 방향으로 확정). 블록 형상에서 계산하고 도면값과 비교한다. * - 일체: 같은 순서끼리 (전열 1 · 후열 1, 전열 2 · 후열 2 …, 각 열의 번호 순) 두 받침의 편심거리가 100 mm를 넘으면 분리를 우선한다. * (P1 은 전열 1–5, 후열 6–10 으로 번호가 매겨져 있어서 번호 자체가 아니라 열 안의 순서로 짝짓는다.) * 편심거리 = 두 받침 중심의 교각축 방향 차이 |s(전열) − s(후열)|. @@ -12,10 +12,10 @@ export const PAIR_ECCENTRICITY_LIMIT_MM = 100; export interface EdgeDistance { no: number; row: BlockModel['row']; - /** 교축 방향: 받침 중심에서 블록의 낮은 쪽(−n) 연단까지 (mm) = C4. null = 쌍 안쪽 (C4·C5 아님). */ - leftMm: number | null; - /** 교축 방향: 받침 중심에서 블록의 높은 쪽(+n) 연단까지 (mm) = C5. null = 쌍 안쪽 (C4·C5 아님). */ - rightMm: number | null; + /** 교각축 방향: 받침 중심에서 블록의 낮은 쪽(−s) 연단까지 (mm) = C4. */ + leftMm: number; + /** 교각축 방향: 받침 중심에서 블록의 높은 쪽(+s) 연단까지 (mm) = C5. */ + rightMm: number; } export interface PairEccentricity { @@ -28,27 +28,18 @@ export interface PairEccentricity { } /** - * C4·C5 from the block geometry: distances along the 교축 from each bearing centre to the block edges (mm). - * 분리: the 1200 block is centred on its bearing, so both are 600. 일체: the pair's 2500 block, so the outer - * margins are 600 (C1) and the inner ones run to the other bearing. + * C4·C5 from the block geometry: distances along the 교각축 from each bearing centre to the block edges (mm). + * 분리: the 1200 block is centred on its bearing, so both are 600. 일체: the pair's block is centred on the pair's mean + * 교각축 position, so each bearing's margins follow its own offset (P1: the outer margins 557). */ export function bearingEdgeDistances(m: PierModel): EdgeDistance[] { - const HALF_SEPARATE = 0.6; // 1200 / 2, m - const HALF_INTEGRATED = 1.25; // 2500 / 2, m + const HALF_DEPTH = 0.6; // 1200 / 2 along the 교각축, m return m.blocks.map((b) => { const host = m.integratedBlocks.find((x) => (b.row === '전열' ? x.frontNo : x.backNo) === b.no); - if (!host) { - return { no: b.no, row: b.row, leftMm: (HALF_SEPARATE) * 1000, rightMm: HALF_SEPARATE * 1000 }; - } - // 일체: only the outer edges are C4 (front, low side) and C5 (back, high side); the inner side faces the other bearing. - const low = host.n - HALF_INTEGRATED; - const high = host.n + HALF_INTEGRATED; - return { - no: b.no, - row: b.row, - leftMm: b.row === '전열' ? (b.n - low) * 1000 : null, - rightMm: b.row === '후열' ? (high - b.n) * 1000 : null, - }; + const centre = host ? host.s : b.s; + const low = centre - HALF_DEPTH; + const high = centre + HALF_DEPTH; + return { no: b.no, row: b.row, leftMm: (b.s - low) * 1000, rightMm: (high - b.s) * 1000 }; }); } diff --git a/src/main.ts b/src/main.ts index bc9abdd..9855e45 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1608,14 +1608,13 @@ function renderBearingLayout(wrap: HTMLDivElement, pier: Pier): void { const table = el('table', undefined, 'grid-table rebar-table'); const head = el('thead'); const hr = el('tr'); - for (const h of ['받침', '열', 'C4 (교축 · 받침 ↔ 블록 바깥 연단, mm)', 'C5 (교축 · 받침 ↔ 블록 바깥 연단, mm)']) hr.appendChild(el('th', h)); + for (const h of ['받침', '열', 'C4 (교각축 · 받침 ↔ 블록 연단, mm)', 'C5 (교각축 · 받침 ↔ 블록 연단, mm)']) hr.appendChild(el('th', h)); head.appendChild(hr); table.appendChild(head); const body = el('tbody'); for (const e of edges) { const tr = el('tr'); - const fmt = (v: number | null) => (v === null ? '—' : v.toFixed(0)); - for (const v of [String(e.no), e.row, fmt(e.leftMm), fmt(e.rightMm)]) tr.appendChild(el('td', v)); + for (const v of [String(e.no), e.row, e.leftMm.toFixed(0), e.rightMm.toFixed(0)]) tr.appendChild(el('td', v)); body.appendChild(tr); } table.appendChild(body); diff --git a/src/view/bearing-plan-svg.ts b/src/view/bearing-plan-svg.ts index acb5664..b3f27b0 100644 --- a/src/view/bearing-plan-svg.ts +++ b/src/view/bearing-plan-svg.ts @@ -79,9 +79,10 @@ export function bearingPlanSvg(m: PierModel, pairIndex: number, overlay?: Bearin `${label}`; const y1 = 760; const y2 = 1000; - parts.push(dimLine(xLeft, X(f.n), y1, `C1 ${Math.round(d(f.no).leftMm ?? 600)}`)); + // C1 and C2 are along the 교축 (horizontal), measured on the drawn positions. + parts.push(dimLine(xLeft, X(f.n), y1, `C1 ${Math.round(X(f.n) - xLeft)}`)); parts.push(dimLine(X(f.n), X(k.n), y1, `C2 ${Math.round(Math.abs(k.n - f.n) * 1000)}`)); - parts.push(dimLine(X(k.n), xRight, y1, `C1 ${Math.round(d(k.no).rightMm ?? 600)}`)); + parts.push(dimLine(X(k.n), xRight, y1, `C1 ${Math.round(xRight - X(k.n))}`)); parts.push(dimLine(xLeft, xRight, y2, `C3 ${Math.round((xRight - xLeft))}`)); // C4 and C5 as in the 시안: vertical dimensions on the left of the blocks, from the top edge to the bearing row (C4) and @@ -90,8 +91,8 @@ export function bearingPlanSvg(m: PierModel, pairIndex: number, overlay?: Bearin const halfDepth = 600; const vdim = (y1: number, y2: number, label: string) => `${label}`; - parts.push(vdim(-halfDepth, 0, `C4 ${Math.round(d(f.no).leftMm ?? 0)}`)); - parts.push(vdim(0, halfDepth, `C5 ${Math.round(d(k.no).rightMm ?? 0)}`)); + parts.push(vdim(-halfDepth, 0, `C4 ${Math.round(d(f.no).leftMm)}`)); + parts.push(vdim(0, halfDepth, `C5 ${Math.round(d(k.no).rightMm)}`)); return `${parts.join('')}`; } diff --git a/tests/bearing-layout.test.ts b/tests/bearing-layout.test.ts index e2c3b6f..4d4a150 100644 --- a/tests/bearing-layout.test.ts +++ b/tests/bearing-layout.test.ts @@ -23,14 +23,18 @@ describe('받침 배치 규칙 (승인 2026-10-26)', () => { } }); - it('일체: the outer margins stay 600 (C4 of the front bearing, C5 of the back bearing)', () => { + it('일체: C4 and C5 along the 교각축 from each bearing to the block edges, from the pair block (centred on the mean)', () => { + const ib = integrated.integratedBlocks[0]; const d = bearingEdgeDistances(integrated); - // The 2500 block is centred on the pair midpoint, so the outer margins are 601 (within the 5 mm drawing tolerance of 600). - expect(d.find((x) => x.no === 1 && x.row === '전열')!.leftMm).toBeCloseTo(600, -1); - expect(d.find((x) => x.no === 6 && x.row === '후열')!.rightMm).toBeCloseTo(600, -1); - // the inner sides face the other bearing of the pair: no C4 or C5 there - expect(d.find((x) => x.no === 1 && x.row === '전열')!.rightMm).toBeNull(); - expect(d.find((x) => x.no === 6 && x.row === '후열')!.leftMm).toBeNull(); + const f = d.find((x) => x.no === 1 && x.row === '전열')!; + const k = d.find((x) => x.no === 6 && x.row === '후열')!; + const fb = integrated.blocks.find((b) => b.no === 1)!; + const kb = integrated.blocks.find((b) => b.no === 6)!; + expect(f.leftMm).toBeCloseTo((fb.s - (ib.s - 0.6)) * 1000, 6); + expect(f.rightMm).toBeCloseTo(((ib.s + 0.6) - fb.s) * 1000, 6); + expect(k.rightMm).toBeCloseTo(((ib.s + 0.6) - kb.s) * 1000, 6); + // the outer margins (front C4, back C5) are equal on P1 + expect(f.leftMm).toBeCloseTo(k.rightMm, 6); }); it('the front and back bearings of one number are about 85 mm apart on P1, so 일체 is allowed', () => {