Files
Pier_v1/tests/rebar3d.test.ts
T
ypshimandClaude Haiku 5.5 a692f1f507 feat(view): 철근표 and the 3D rebar model point at each other (③)
- The 3D model of ③ draws each bar family from the rebar modules (coping top and
  bottom bars, shear loops, side bars, column bars and ties, footing B1–B8, bearing
  S1/S2) and names every bar as its 철근표 number.
- A table row click highlights the bar in 3D (the others dim); a click on a 3D bar
  selects its row in the table and sets the member tab. Drags still rotate.
- The rebar is shown only on ③. Not drawn yet: C14, C15/C16, B9–B12, the couplers,
  and the bars of a bent coping.
- Tests: family names and counts (P1 46), highlight behaviour.
- Not verified in a browser.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-22 12:31:26 +09:00

31 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import * as THREE from 'three';
import { buildPier } from '../src/core/geometry';
import { buildRebar3D } from '../src/view/rebar3d';
import { loadP1 } from './helpers';
const rb = buildRebar3D(buildPier(loadP1()));
describe('3D 철근 모델 (③)', () => {
it('every 철근표 family has bars, named as in the table', () => {
for (const n of ['C1', 'C4', 'C7', 'C9', 'C10', 'C11', 'C12', 'C13', 'P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'B1', 'B4', 'B5', 'B6', 'B7', 'B8', 'S1', 'S2']) {
expect(rb.byName.get(n)?.length ?? 0, n).toBeGreaterThan(0);
}
});
it('P1 has one bar per 원주 등분 (46) and P2 likewise', () => {
expect(rb.byName.get('P1')!.length).toBe(46);
expect(rb.byName.get('P2')!.length).toBe(46);
});
it('highlight dims the other bars and keeps the chosen one', () => {
rb.highlight('P3');
const p3 = (rb.byName.get('P3')![0].material as THREE.MeshStandardMaterial).opacity;
const c1 = (rb.byName.get('C1')![0].material as THREE.MeshStandardMaterial).opacity;
expect(p3).toBe(1);
expect(c1).toBeLessThan(1);
rb.highlight(null);
expect((rb.byName.get('C1')![0].material as THREE.MeshStandardMaterial).opacity).toBe(1);
});
});