fix: keep complex islands beyond outer lane edge
This commit is contained in:
1 parent
3ed503a986
commit
c3579074fd
3 files changed
+19
-2
No files matched your search
@@ -547,7 +547,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
|||||||
landing(first, pair.a),
|
landing(first, pair.a),
|
||||||
landing(second, pair.b),
|
landing(second, pair.b),
|
||||||
COMPLEX_CROSSWALK_DEPTH_METERS,
|
COMPLEX_CROSSWALK_DEPTH_METERS,
|
||||||
{ maxLegLength: outerRadius },
|
{ maxLegLength: outerRadius, minLegLength: Math.max(outerRadius - coreRadius, COMPLEX_CROSSWALK_DEPTH_METERS) },
|
||||||
);
|
);
|
||||||
if (contactSolution.status !== 'solved') {
|
if (contactSolution.status !== 'solved') {
|
||||||
cornerDiagnostics.push(
|
cornerDiagnostics.push(
|
||||||
|
|||||||
@@ -145,7 +145,10 @@ function solveIslandContacts(firstSegment, secondSegment, thirdWidth, options =
|
|||||||
const tangent = unit(chord);
|
const tangent = unit(chord);
|
||||||
// This scale leaves positive connectors on both sides even for unequal depths.
|
// This scale leaves positive connectors on both sides even for unequal depths.
|
||||||
const scale = 1 + thirdWidth / chordLength;
|
const scale = 1 + thirdWidth / chordLength;
|
||||||
const legLengths = [a * scale, b * scale];
|
const baseLegLengths = [a * scale, b * scale];
|
||||||
|
const minimumLegLength = Number.isFinite(options.minLegLength) ? Math.max(0, options.minLegLength) : 0;
|
||||||
|
const legScale = Math.max(1, minimumLegLength / Math.max(...baseLegLengths));
|
||||||
|
const legLengths = baseLegLengths.map((value) => value * legScale);
|
||||||
if (
|
if (
|
||||||
options.maxLegLength !== undefined &&
|
options.maxLegLength !== undefined &&
|
||||||
(!Number.isFinite(options.maxLegLength) || legLengths.some((value) => value > options.maxLegLength))
|
(!Number.isFinite(options.maxLegLength) || legLengths.some((value) => value > options.maxLegLength))
|
||||||
|
|||||||
@@ -151,6 +151,20 @@ assert.equal(solvedContacts.contacts.length, 3);
|
|||||||
assert.equal(solvedContacts.greenRing.length, 7);
|
assert.equal(solvedContacts.greenRing.length, 7);
|
||||||
assert.equal(solvedContacts.legLengths.length, 2);
|
assert.equal(solvedContacts.legLengths.length, 2);
|
||||||
assert.ok(solvedContacts.legLengths.every((value) => value > 5.1));
|
assert.ok(solvedContacts.legLengths.every((value) => value > 5.1));
|
||||||
|
const extendedContacts = solveIslandContacts(
|
||||||
|
[
|
||||||
|
[0, 1.7],
|
||||||
|
[0, 5.1],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[-1.7, 0],
|
||||||
|
[-5.1, 0],
|
||||||
|
],
|
||||||
|
3.4,
|
||||||
|
{ maxLegLength: 20, minLegLength: 9 },
|
||||||
|
);
|
||||||
|
assert.equal(extendedContacts.status, 'solved');
|
||||||
|
assert.ok(extendedContacts.legLengths.every((value) => value >= 9));
|
||||||
|
|
||||||
assert.equal(new Set(solvedContacts.greenRing.slice(0, -1).map((p) => p.join(','))).size, 6);
|
assert.equal(new Set(solvedContacts.greenRing.slice(0, -1).map((p) => p.join(','))).size, 6);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user