import type { PierModel } from '../core/geometry'; import type { CastLayout } from '../core/rebar/cast-layout'; /** Front and section projections of the same centre lines used in the 3D scene. */ export function castRebarSvg(model: PierModel, layout: CastLayout): string { const bars = layout.bars.filter(b => b.columnIndex === 0); if (!bars.length) return '
입력 오류를 확인하세요. 생성된 기둥·말뚝 철근이 없습니다.
'; const pts = bars.flatMap(b => b.pts); const bottom = pts.reduce((a, p) => Math.min(a, p[1]), Infinity); const top = pts.reduce((a, p) => Math.max(a, p[1]), -Infinity); const diameter = model.columnDiameterMm / 1000; const scale = Math.min(180 / diameter, 480 / (top - bottom)); const x = (v: number) => 130 + (v - model.columns[0].s) * scale; const y = (v: number) => 35 + (top - v) * scale; const colour = (kind: string) => kind === 'main' ? '#0f5c66' : kind === 'coupler' ? '#0b3f46' : '#6b3fa0'; const front = bars.map(b => `