test(junction): reject zero-area approach surfaces
This commit is contained in:
1 parent
b3a2d5fcd5
commit
a90826efed
1 file changed
+6
@@ -138,6 +138,12 @@ for (const feature of complexApproachFeatures) {
|
|||||||
const ring = feature.geometry?.coordinates?.[0] || [];
|
const ring = feature.geometry?.coordinates?.[0] || [];
|
||||||
assert.ok(ring.length >= 4 && ring[0][0] === ring.at(-1)[0] && ring[0][1] === ring.at(-1)[1]);
|
assert.ok(ring.length >= 4 && ring[0][0] === ring.at(-1)[0] && ring[0][1] === ring.at(-1)[1]);
|
||||||
assert.ok(ring.every((coordinate) => coordinate.every(Number.isFinite)));
|
assert.ok(ring.every((coordinate) => coordinate.every(Number.isFinite)));
|
||||||
|
const area = Math.abs(
|
||||||
|
ring
|
||||||
|
.slice(1)
|
||||||
|
.reduce((sum, coordinate, index) => sum + ring[index][0] * coordinate[1] - coordinate[0] * ring[index][1], 0) / 2,
|
||||||
|
);
|
||||||
|
assert.ok(area > 0, 'compiled complex approach surface must have positive area');
|
||||||
}
|
}
|
||||||
const complexFeatures = Object.values(complexGeometry).flatMap((layer) => layer?.features || []);
|
const complexFeatures = Object.values(complexGeometry).flatMap((layer) => layer?.features || []);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|||||||
Reference in new issue
Block a user