Docs: Update Gemini benchmark results

This commit is contained in:
github-actions[bot]
2025-11-18 19:30:39 +00:00
parent 51a98c1e1b
commit 76fb066932
133 changed files with 2340 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
const findConvexHull = async (pts) => {
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm')
const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y'])
if (s.length < 3) return s
const x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x)
const m = (l) => l.reduce((h, p) => {
while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop()
h.push(p)
return h
}, [])
const l = m(s)
const u = m([...s].reverse())
return [...l.slice(0, -1), ...u.slice(0, -1)]
}
export default findConvexHull;

View File

@@ -0,0 +1,13 @@
const findConvexHull = async (pts) => {
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm');
const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']);
if (s.length < 3) return s;
const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
const f = (h, p) => {
while (h.length > 1 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop();
h.push(p);
return h;
};
return [...s.reduce(f, []).slice(0, -1), ...s.reduceRight(f, []).slice(0, -1)];
};
export default findConvexHull;

View File

@@ -0,0 +1,27 @@
const findConvexHull = async (pts) => {
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm');
if (!Array.isArray(pts)) throw new Error('Input must be an array');
const u = _.uniqWith(pts, _.isEqual);
if (u.length < 3) return u;
const s = _.sortBy(u, ['x', 'y']);
const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
const h = [];
for (const p of s) {
while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop();
h.push(p);
}
const t = h.length + 1;
for (let i = s.length - 2; i >= 0; i--) {
const p = s[i];
while (h.length >= t && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop();
h.push(p);
}
h.pop();
return h;
};
export default findConvexHull;

View File

@@ -0,0 +1,24 @@
const findConvexHull = async (pts) => {
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm')
const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y'])
if (s.length < 3) return s
const cross = (a, b, o) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x)
const build = (list) => {
const h = []
for (const p of list) {
while (h.length >= 2 && cross(h[h.length - 1], p, h[h.length - 2]) <= 0) h.pop()
h.push(p)
}
return h
}
const l = build(s)
const u = build([...s].reverse())
l.pop()
u.pop()
return [...l, ...u]
}
export default findConvexHull;

View File

@@ -0,0 +1,16 @@
const findConvexHull = async (pts) => {
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm')
const u = _.uniqWith(pts, _.isEqual)
if (u.length < 3) return u
const s = _.sortBy(u, ['x', 'y'])
const cp = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x)
const scan = (lst) => lst.reduce((h, p) => {
while (h.length >= 2 && cp(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop()
h.push(p)
return h
}, [])
const l = scan(s)
const up = scan([...s].reverse())
return [...l.slice(0, -1), ...up.slice(0, -1)]
}
export default findConvexHull;

View File

@@ -0,0 +1,17 @@
const findConvexHull = async (pts) => {
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm')
const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y'])
if (s.length < 3) return s
const k = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x)
const m = (v) => {
const h = []
for (const p of v) {
while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop()
h.push(p)
}
return h
}
const l = m(s), u = m(s.reverse())
return l.slice(0, -1).concat(u.slice(0, -1))
}
export default findConvexHull;

View File

@@ -0,0 +1,22 @@
const findConvexHull = async points => {
const { default: _ } = await import('https://esm.sh/lodash')
const s = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y'])
if (s.length < 3) return s
const h = [], x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x)
s.forEach(p => {
while (h.length >= 2 && x(h.at(-2), h.at(-1), p) <= 0) h.pop()
h.push(p)
})
const t = h.length + 1
for (let i = s.length - 2; i >= 0; i--) {
while (h.length >= t && x(h.at(-2), h.at(-1), s[i]) <= 0) h.pop()
h.push(s[i])
}
h.pop()
return h
}
export default findConvexHull;

View File

@@ -0,0 +1,24 @@
const findConvexHull = async (pts) => {
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm');
const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']);
if (s.length < 3) return s;
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
const h = [];
for (let i = 0; i < s.length; i++) {
while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop();
h.push(s[i]);
}
const t = h.length + 1;
for (let i = s.length - 2; i >= 0; i--) {
while (h.length >= t && cross(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop();
h.push(s[i]);
}
h.pop();
return h;
};
export default findConvexHull;

View File

@@ -0,0 +1,23 @@
const findConvexHull = async (pts) => {
if (!pts?.length || pts.length < 3) return pts || [];
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm');
const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']);
const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
const scan = (list) => {
const h = [];
for (const p of list) {
while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop();
h.push(p);
}
return h;
};
const l = scan(s);
const u = scan(s.reverse());
return [...l.slice(0, -1), ...u.slice(0, -1)];
};
export default findConvexHull;

View File

@@ -0,0 +1,19 @@
const findConvexHull = async (pts) => {
const { default: _ } = await import('https://esm.sh/lodash');
const u = _.uniqWith(pts, _.isEqual);
if (u.length < 3) return u;
const s = _.sortBy(u, ['x', 'y']);
const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
const f = (l) => {
const h = [];
for (const p of l) {
while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop();
h.push(p);
}
return h;
};
const l = f(s);
const h = f([...s].reverse());
return [...l.slice(0, -1), ...h.slice(0, -1)];
};
export default findConvexHull;

View File

@@ -0,0 +1,22 @@
const findConvexHull = async (points) => {
const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm')
const P = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y'])
if (P.length < 3) return P
const xp = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x)
const scan = (arr) => {
const h = []
for (const p of arr) {
while (h.length >= 2 && xp(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop()
h.push(p)
}
return h
}
const l = scan(P)
const u = scan(P.reverse())
return [...l.slice(0, -1), ...u.slice(0, -1)]
}
export default findConvexHull;

View File

@@ -0,0 +1,23 @@
const findConvexHull = async (points) => {
const { default: _ } = await import('https://esm.sh/lodash');
const P = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']);
if (P.length < 3) return P;
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
const h = [];
for (const p of P) {
while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop();
h.push(p);
}
const t = h.length + 1;
for (let i = P.length - 2; i >= 0; i--) {
while (h.length >= t && cross(h[h.length - 2], h[h.length - 1], P[i]) <= 0) h.pop();
h.push(P[i]);
}
h.pop();
return h;
};
export default findConvexHull;