fix: curve complex island away from junction core
This commit is contained in:
1 parent
f122e8236a
commit
95b8f068aa
2 files changed
+19
-1
No files matched your search
@@ -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);
|
||||
|
||||
@@ -30,6 +30,16 @@ assert.deepEqual(sketchIsland[0], sketchIsland.at(-1));
|
||||
assert.ok(sketchIsland.every(([x, y]) => x <= 0 && y >= 0));
|
||||
const arcMiddle = sketchIsland[7];
|
||||
assert.ok(arcMiddle[1] - arcMiddle[0] < 6.8, 'hypotenuse bends toward the right-angle vertex');
|
||||
const longEdgeStart = sketchIsland[18];
|
||||
const longEdgeEnd = sketchIsland[34];
|
||||
const longEdgeMid = sketchIsland[26];
|
||||
const longEdgeCross =
|
||||
(longEdgeEnd[0] - longEdgeStart[0]) * (longEdgeMid[1] - longEdgeStart[1]) -
|
||||
(longEdgeEnd[1] - longEdgeStart[1]) * (longEdgeMid[0] - longEdgeStart[0]);
|
||||
const cornerSideCross =
|
||||
(longEdgeEnd[0] - longEdgeStart[0]) * (0 - longEdgeStart[1]) -
|
||||
(longEdgeEnd[1] - longEdgeStart[1]) * (0 - longEdgeStart[0]);
|
||||
assert.ok(longEdgeCross * cornerSideCross > 0, 'long edge must bow toward the right-angle vertex');
|
||||
for (const crossing of [
|
||||
[
|
||||
[0, 0],
|
||||
|
||||
Reference in new issue
Block a user