fix(core): refuse bends that double back; use a valid synthetic bend in tests

The earlier synthetic bend (IP3 at (6, 2)) put IP4 ahead of IP3 on the turned
line, so the axis folded back on itself. buildPier now refuses a kink behind
IP1 along IP1→IP2 or an IP3 behind the kink along the turned direction. Tests
use IP3 (9, −3.464), a valid 60° right turn with kink (7, 0).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
ypshimandClaude Haiku 5.5 committed 2026-10-22 09:33:09 +09:00
1 parent 5371932cca
commit c9dae4ff9b
3 files changed
+29 -9

No files matched your search

+12 -4
View File
@@ -6,16 +6,16 @@ import { buildPierScene, mitrePlane } from '../src/view/scene';
import type { PierInput } from '../src/core/types';
import { loadP1 } from './helpers';
// Constructed bend: IP1 (0, 0), IP2 (1, 0), IP3 (6, 2), 60° right turn. The kink sits at arc ≈ 7.15 m,
// inside a 6 m coping centred on the axis, and a T형 column (arc ≈ 4.73) stays clear of it.
// Constructed bend: IP1 (0, 0), IP2 (1, 0), 60° right turn, kink (7, 0), IP3 (9, −3.464) four metres ahead on the turned line.
// Axis length 11 m; a 6 m coping centred on it has its kink at g = 4.5, and the T형 column (g = 3) stays 1.5 m clear of it.
const IP1 = { e: 0, n: 0 };
const IP3 = { e: 6, n: 2 };
const IP3 = { e: 9, n: -3.4641016 };
const ANGLE = 60;
const L = 6;
const B = 3.1;
const FRONT_N = -0.7;
const BACK_N = 0.6;
const GS = [0.8, 1.9, 3.0, 4.1, 5.2];
const GS = [0.6, 1.9, 3.2];
function bentInput(foundationType: PierInput['foundationType'] = '현장타설말뚝'): PierInput {
const base = loadP1();
@@ -133,3 +133,11 @@ describe('bent coping model (stage 2)', () => {
expect(() => buildPier(bad)).toThrow('꺾임점이 코핑 범위 밖');
});
});
describe('bend geometry must move forward', () => {
it('IP3 behind the kink on the turned line is refused', () => {
const base = bentInput();
const ips = base.ips.map((p) => (p.name === 'IP3' ? { ...p, x: 6, y: 2 } : p));
expect(() => buildPier({ ...base, ips })).toThrow('꺾임각과 IP 배치');
});
});