- 지형 격자가 없으면 교각 지반고 위치에 얇은 선(코핑 길이 + 여유 2 m)만 그림 - 전체 보기에서도 지형이 없으면 교각별 지반고 선을 표시, 지형이 있으면 공유 격자만 표시 - 부재 표시 '지반' 체크박스는 두 경우 모두 동작 - 테스트: 얇은 선 위치와 길이, 지형 있을 때 선 미표시 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
39 lines
1.7 KiB
TypeScript
39 lines
1.7 KiB
TypeScript
import * as THREE from 'three';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { buildPier } from '../src/core/geometry';
|
|
import type { TerrainGrid } from '../src/core/ground-model';
|
|
import { buildPierScene } from '../src/view/scene';
|
|
import { loadP1 } from './helpers';
|
|
|
|
const model = buildPier(loadP1());
|
|
|
|
const terrain: TerrainGrid = { origin: [259815.676, 179088.094], step: 5, nx: 2, ny: 2, z: [30, 31, 32, 33] };
|
|
|
|
describe('지반 표시 (지형 모델이 없을 때)', () => {
|
|
it('draws a thin ground-level line at the pier 지반고, not a 60 m square', () => {
|
|
const scene = buildPierScene(model);
|
|
const box = new THREE.Box3().setFromObject(scene.parts.ground);
|
|
const size = box.getSize(new THREE.Vector3());
|
|
// Thin: a line, not a plane. Centred on the ground EL.
|
|
expect(size.y).toBeLessThan(0.1);
|
|
expect(box.getCenter(new THREE.Vector3()).y).toBeCloseTo(model.groundEl, 2);
|
|
// Spans the coping along the pier, plus a small margin. The line may be rotated to the 교축, so measure its
|
|
// horizontal extent as a diagonal of the box's x and z extents.
|
|
const plan = Math.hypot(size.x, size.z);
|
|
expect(plan).toBeGreaterThan(model.copingL);
|
|
expect(plan).toBeLessThan(model.copingL + 3);
|
|
});
|
|
|
|
it('keeps the ground group out of the pier size', () => {
|
|
const scene = buildPierScene(model);
|
|
expect(scene.size).toBeLessThan(60);
|
|
});
|
|
|
|
it('does not draw the line when the terrain grid is present (the terrain replaces it)', () => {
|
|
const scene = buildPierScene(model, terrain);
|
|
expect(scene.parts.ground.children.length).toBe(1);
|
|
const mesh = scene.parts.ground.children[0] as THREE.Mesh;
|
|
expect(mesh.geometry.type).toBe('BufferGeometry');
|
|
});
|
|
});
|