fix: curve complex island away from junction core

This commit is contained in:
que01 committed 2026-09-15 11:06:30 +08:00
1 parent f122e8236a
commit 95b8f068aa
2 files changed
+19 -1

No files matched your search

+9 -1
View File
@@ -168,7 +168,15 @@ function solveIslandContacts(firstSegment, secondSegment, thirdWidth, options =
) / 2;
if (hexArea <= 1e-8) return fail('degenerate-contact-hexagon');
const ring = [];
const controls = [firstTip, secondTip, corner];
const midpoint = (a, b) => a.map((value, axis) => (value + b[axis]) / 2);
// The hypotenuse must bow toward the right-angle vertex. The final inner
// roundover is pushed away from that vertex so the island does not intrude
// into the vehicle swept area behind the two perpendicular crossings.
const hypotenuseMidpoint = midpoint(contacts[1][1], contacts[2][0]);
const hypotenuseControl = hypotenuseMidpoint.map((value, axis) => value * 0.55 + corner[axis] * 0.45);
const innerMidpoint = midpoint(contacts[2][1], contacts[0][0]);
const innerControl = innerMidpoint.map((value, axis) => value * 1.35 - corner[axis] * 0.35);
const controls = [firstTip, hypotenuseControl, innerControl];
const steps = 16;
contacts.forEach((contact, index) => {
ring.push(...contact);