feat(view): colour the ③ 3D rebar by diameter or by member, with a legend

Role colours stay the default (spec §6.7). A control on ③ switches to diameter (nominal size, H and S of one size
share a colour, Okabe–Ito palette) or member (받침블럭 · 코핑 · 기둥 · 확대기초). The legend lists only the items
the model has. Highlighting and the state colours are unchanged. Approved 2026-10-23.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
ypshimandClaude Haiku 5.5 committed 2026-10-23 09:10:20 +09:00
1 parent 5d5ad7e997
commit d35e27e7de
6 files changed
+176 -3

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
/**
* Colour keys of the ③ 3D rebar (spec §6.7). Pure: no three.js here. The palettes are in the view.
*/
export type RebarMemberKey = 'bearing' | 'coping' | 'column' | 'footing' | 'other';
/** Member of a bar from its 철근표 name (C = coping, P = column, B = footing, S = bearing block, 커플러 = column). */
export function memberOfBar(name: string): RebarMemberKey {
if (name.includes('커플러') || /^P\d/.test(name)) return 'column';
if (/^C\d/.test(name)) return 'coping';
if (/^B\d/.test(name)) return 'footing';
if (/^S\d/.test(name)) return 'bearing';
return 'other';
}
/**
* Nominal diameters (mm). H and S of the same size share one group (decision 2026-10-23): D13 12.7 · H16/S16 15.9 · …
* The order is the colour order of the 직경 mode.
*/
export const DIAMETER_GROUPS: readonly { mm: number; label: string }[] = [
{ mm: 12.7, label: 'D13' },
{ mm: 15.9, label: 'H16 · S16' },
{ mm: 19.1, label: 'H19 · S19' },
{ mm: 22.2, label: 'D22' },
{ mm: 25.4, label: 'H25 · S25' },
{ mm: 28.6, label: 'H29' },
{ mm: 31.8, label: 'S32' },
{ mm: 34.9, label: 'D35' },
];
/** Index into {@link DIAMETER_GROUPS}, or -1 for a diameter that is not a rebar size (e.g. a coupler). */
export function diameterGroupIndex(dMm: number): number {
return DIAMETER_GROUPS.findIndex((g) => Math.abs(g.mm - dMm) < 0.05);
}