fix: coordinate crosswalk landings across all four islands
This commit is contained in:
1 parent
1b91e280bc
commit
695bf21a84
6 files changed
+121
-25
No files matched your search
@@ -108,12 +108,12 @@ assert.deepEqual(
|
||||
|
||||
const solvedContacts = solveIslandContacts(
|
||||
[
|
||||
[0, 0],
|
||||
[0, 6.8],
|
||||
[0, 1.7],
|
||||
[0, 5.1],
|
||||
],
|
||||
[
|
||||
[0, 0],
|
||||
[-6.8, 0],
|
||||
[-1.7, 0],
|
||||
[-5.1, 0],
|
||||
],
|
||||
3.4,
|
||||
{ maxLegLength: 20 },
|
||||
@@ -122,4 +122,47 @@ assert.equal(solvedContacts.status, 'solved');
|
||||
assert.equal(solvedContacts.contacts.length, 3);
|
||||
assert.equal(solvedContacts.greenRing.length, 7);
|
||||
assert.equal(solvedContacts.legLengths.length, 2);
|
||||
assert.ok(solvedContacts.legLengths.every((value) => value > 6.8));
|
||||
assert.ok(solvedContacts.legLengths.every((value) => value > 5.1));
|
||||
|
||||
assert.equal(new Set(solvedContacts.greenRing.slice(0, -1).map((p) => p.join(','))).size, 6);
|
||||
|
||||
// Regression: the saved four-node, 21m cluster previously lost two islands.
|
||||
{
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const compiler = require('../src');
|
||||
const model = compiler.nativeRoad.compileRoadModel(
|
||||
fs.readFileSync(path.join(__dirname, '../inputs/osm/枫树二路.osm'), 'utf8'),
|
||||
{ overrides: [] },
|
||||
);
|
||||
const geometry = compiler.nativeRoad.compileGeometry(
|
||||
model,
|
||||
{ overrides: [] },
|
||||
{
|
||||
edgeLines: false,
|
||||
junctionTemplates: {
|
||||
enabled: true,
|
||||
clusters: [
|
||||
{
|
||||
id: 'four-node-contact-regression',
|
||||
template: 'complex-junction-v1',
|
||||
coreRadiusMeters: 21,
|
||||
nodeIds: ['8005332807', '8024512135', '8024512145', '8024512147'],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
);
|
||||
const outer = geometry.sidewalkSurface.features.filter((f) => f.properties.kind === 'island');
|
||||
const green = geometry.sidewalkSurface.features.filter((f) => f.properties.kind === 'island-green');
|
||||
assert.equal(outer.length, 4, 'all four corners must publish islands');
|
||||
assert.equal(green.length, 4, 'all four islands must publish green contact polygons');
|
||||
assert.equal(new Set(green.map((f) => f.properties.corner_key)).size, 4);
|
||||
for (const feature of green) {
|
||||
const points = feature.geometry.coordinates[0].slice(0, -1);
|
||||
assert.equal(new Set(points.map((p) => p.join(','))).size, 6);
|
||||
const island = outer.find((f) => f.properties.corner_key === feature.properties.corner_key);
|
||||
assert.deepEqual(points, island.properties.contact_points);
|
||||
}
|
||||
assert.equal(geometry.diagnostics.filter((d) => d.rule === 'complex-junction-island-infeasible').length, 0);
|
||||
}
|
||||
Reference in new issue
Block a user