@realsee/dnalogel
Version:
14 lines (13 loc) • 421 B
JavaScript
import * as r from "three";
import u from "earcut";
function m(i) {
const t = [...new Set(i)];
if (t.length < 3)
return;
t.at(-1).equals(t[0]) || t.push(t[0]);
const n = t.flatMap((o) => [o.x, o.y, o.z]), s = new r.Float32BufferAttribute(n, 3), a = u(n, void 0, 3), e = new r.BufferGeometry();
return e.setAttribute("position", s), e.setIndex(a), e.name = "PolygonGeometry", e;
}
export {
m as default
};