Docs: Update benchmark for stealth/union-alpha EFF:high

This commit is contained in:
github-actions[bot]
2026-09-16 16:14:56 +00:00
parent ddcf1af44b
commit 0f704a2f22
12 changed files with 516 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
async function findConvexHull(points) {
if (!Array.isArray(points) || points.some(
p => !p || !Number.isFinite(p.x) || !Number.isFinite(p.y)
)) {
throw new TypeError("Expected an array of points with finite numeric x and y.");
}
const { default: _ } = await import(
"https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm"
);
const sorted = _.sortBy(
_.uniqBy(points, p => JSON.stringify([p.x, p.y])),
["x", "y"]
);
if (sorted.length < 3) return sorted;
const cross = (a, b, c) =>
(b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
const build = list => {
const hull = [];
for (const p of list) {
while (
hull.length > 1 &&
cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0
) hull.pop();
hull.push(p);
}
hull.pop();
return hull;
};
return [...build(sorted), ...build([...sorted].reverse())];
}
export default findConvexHull;
// Generation time: 113.790s
// Result: PASS