fix: coordinate crosswalk landings across all four islands

This commit is contained in:
que01 committed 2026-09-14 09:43:12 +08:00
1 parent 1b91e280bc
commit 695bf21a84
6 files changed
+121 -25

No files matched your search

+4 -2
View File
@@ -134,8 +134,8 @@ function solveIslandContacts(firstSegment, secondSegment, thirdWidth, options =
second = ordered(secondSegment);
const u = unit(sub(first[1], corner)),
v = unit(sub(second[1], corner));
// A short edge may begin exactly at the supporting-line intersection; this
// is the intended right-angle landing and is still a complete contact.
if (dot(sub(first[0], corner), u) <= 1e-8 || dot(sub(second[0], corner), v) <= 1e-8)
return fail('contact-crosses-corner');
const a = length(sub(first[1], corner)),
b = length(sub(second[1], corner));
const chord = sub(second[1], first[1]),
@@ -157,6 +157,8 @@ function solveIslandContacts(firstSegment, secondSegment, thirdWidth, options =
if (dot(outward, sub(thirdCenter, corner)) < 0) outward = outward.map((value) => -value);
const contacts = [first, thirdContact, [second[1], second[0]]];
const vertices = contacts.flat();
if (vertices.some((p, i) => vertices.slice(i + 1).some((q) => length(sub(p, q)) < 1e-8)))
return fail('duplicate-contact-endpoints');
const hexArea =
Math.abs(
vertices.reduce((sum, point, i) => {