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:
1 parent
5371932cca
commit
c9dae4ff9b
3 files changed
+29
-9
No files matched your search
+5
-5
@@ -37,21 +37,21 @@ describe('straight axis (regression against spec §12)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// Synthetic bend: IP1 (0, 0), IP2 (1, 0), IP3 (6, 2), 60° right turn. The P1 sheet is straight (IP1, IP2, IP3 collinear),
|
||||
// so P1 cannot exercise a bend. The kink falls at about s = 7.15 m, inside a 6 m coping centred on the axis.
|
||||
// Synthetic bend: IP1 (0, 0), IP2 (1, 0), kink (7, 0), IP3 (9, −3.464), a 60° right turn with IP3 ahead on the turned line.
|
||||
// The P1 sheet is straight (IP1, IP2, IP3 collinear), so P1 cannot exercise a bend.
|
||||
describe('bent axis IP1 → IP4 → IP3', () => {
|
||||
const p1 = loadP1();
|
||||
const ip1 = { e: 0, n: 0 };
|
||||
const ip2 = { e: 1, n: 0 };
|
||||
const ip3 = { e: 6, n: 2 };
|
||||
const ip3 = { e: 9, n: -3.4641016 };
|
||||
const kink = solveIp4(ip1, ip2, ip3, 60)!;
|
||||
const axis = buildAxis(ip1, ip3, kink);
|
||||
const a = kinkArc(axis)!;
|
||||
|
||||
it('kink lies on the IP1→IP2 line, at s ≈ 7.15, and the arc length adds the two stretches', () => {
|
||||
it('kink lies on the IP1→IP2 line, at s = 7, and the arc length adds the two stretches', () => {
|
||||
const cross = (kink.e - ip1.e) * (ip2.n - ip1.n) - (kink.n - ip1.n) * (ip2.e - ip1.e);
|
||||
expect(cross).toBeCloseTo(0, 9);
|
||||
expect(a).toBeCloseTo(7.15, 1);
|
||||
expect(a).toBeCloseTo(7, 6);
|
||||
const len2 = Math.hypot(ip3.e - kink.e, ip3.n - kink.n);
|
||||
expect(axis.length).toBeCloseTo(a + len2, 9);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user