import { describe, expect, it } from 'vitest'; import * as THREE from 'three'; import { buildPier } from '../src/core/geometry'; import { solplateGeometry } from '../src/core/solplate'; import { buildPierScene } from '../src/view/scene'; import { loadP1 } from './helpers'; describe('솔플레이트 모델과 3D (C안, 2026-11-03)', () => { it('every pier has a solplate plan from its rule; the default gives T 25 and h3 186', () => { const m = buildPier(loadP1()); expect(m.blocks.every((b) => b.plan.T === 25 && b.plan.h3 === 186)).toBe(true); }); it('a pier rule changes its own plan: 받침높이 211 and slope −1 % give T 27 and h3 184', () => { const m = buildPier({ ...loadP1(), solplate: { heightMm: 211, lengthMm: 1000, widthMm: 1100, slopePct: -1 } }); expect(m.blocks[0].plan.T).toBe(27); expect(m.blocks[0].plan.h3).toBe(184); }); it('the 3D scene has one solplate wedge per bearing, and its highest point is the thick end of the tallest one', () => { const m = buildPier(loadP1()); const scene = buildPierScene(m); const wedges = scene.parts.solplates.children; expect(wedges.length).toBe(10); const box = new THREE.Box3().setFromObject(scene.parts.solplates); const top = Math.max(...m.blocks.map((b) => solplateGeometry(b, b.plan).bottom + solplateGeometry(b, b.plan).T1)); expect(box.max.y).toBeCloseTo(top, 3); }); it('the 교량받침 본체 is one box per bearing: the plan less 100 mm on each side, height h3 (186 mm)', () => { const scene = buildPierScene(buildPier(loadP1())); const bodies = scene.parts.bearings.children; expect(bodies.length).toBe(10); const one = new THREE.Box3().setFromObject(bodies[0]); expect(one.max.y - one.min.y).toBeCloseTo(0.186, 3); // Body: L − 200 = 800 across the 교각축 직각, W − 200 = 900 along the 교축; the row skew turns it a few degrees. expect(Math.max(one.max.x - one.min.x, one.max.z - one.min.z)).toBeGreaterThan(0.85); }); });