Docs: Update benchmark results

This commit is contained in:
github-actions[bot]
2025-11-07 22:07:45 +00:00
parent b5f81c6e8a
commit 1687dca49c
42 changed files with 784 additions and 847 deletions

View File

@@ -1,15 +1,15 @@
const findConvexHull = async (points) => {
const { sortBy, uniqWith } = await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/lodash.min.js');
async function findConvexHull(points) {
const _ = await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/lodash.min.js').then(m => m.default);
if (points.length < 3) return points;
const sorted = sortBy(uniqWith(points, (a, b) => a.x === b.x && a.y === b.y), ['x', 'y']);
const sorted = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']);
if (sorted.length < 3) return sorted;
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
const buildHalf = (pts) => {
const buildHull = pts => {
const hull = [];
for (const p of pts) {
while (hull.length >= 2 && cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0) {
@@ -21,9 +21,6 @@ const findConvexHull = async (points) => {
return hull;
};
const lower = buildHalf(sorted);
const upper = buildHalf([...sorted].reverse());
return [...lower, ...upper].reverse();
};
return [...buildHull(sorted), ...buildHull(sorted.slice().reverse())];
}
export default findConvexHull;