Commit cc1f9fb
fix(library): compare port seats exactly so both flanks of a fan nest alike
The reported "right side is off, like stmt -> }": a symmetric diagram was drawn
lopsided. Its left flank nested its two detours on different corner rings while
the right flank collapsed both onto one shared elbow.
Root cause is a floating-point comparison on a decision path — the exact hazard
this subsystem's "integer, exactly computed" rule exists to prevent, introduced by
the ring selection added in the previous commit. A seat and its mirror image lie
the same distance from their side's centre in exact arithmetic but not in binary
floating point: for a seven-way band,
0.5 - 1/7 = 0.35714285714285715
6/7 - 0.5 = 0.3571428571428571 (smaller in the final bit)
Ring choice compared each seat's distance against the largest on its side, so the
right-hand member of every mirror pair failed the test by one ulp, lost the roomy
ring, and fell back onto the tight corner its neighbour already used. Rounding the
distance to whole permille before comparing makes reflection exact — far finer
than any seat spacing, far coarser than the artefact. Both flanks now nest
identically: bends land at (30,360)/(45,375) and mirror to (350,360)/(335,375).
Covered by a regression test that fails on the previous arithmetic.
Known remaining limitation, unchanged by this fix: when many edges share one short
node side (five on a 70px side seats them 12px apart) a fan leaves the node too
narrow to read as separate lines until the routes have travelled some distance.
Widening it means letting a crowded side overflow onto its neighbours, which is a
change to the shared port-assignment stage rather than to straight edges alone.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H4AtGeJaSWiGooNonpVcxN1 parent 70b9c05 commit cc1f9fb
2 files changed
Lines changed: 55 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1353 | 1353 | | |
1354 | 1354 | | |
1355 | 1355 | | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
1356 | 1363 | | |
1357 | | - | |
| 1364 | + | |
1358 | 1365 | | |
1359 | 1366 | | |
1360 | 1367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
345 | 392 | | |
346 | 393 | | |
347 | 394 | | |
| |||
0 commit comments