Face corners in model units
64-bitThe corners of an add-on's solid in the 3D model's units, and where the solid is placed.
local = (q − o) × k; translation = o × k
Each corner is one subtraction and one multiplication in 64-bit. The mesh is stored relative to its first corner, and that corner × k is the placement's translation, so a placed corner is (q − o) × k + o × k rather than q × k computed in one step.
const polys = spec && Array.isArray(spec.polys) ? spec.polys.filter((p) => Array.isArray(p) && p.length >= 3 && p.every((q) => Array.isArray(q) && q.length === 3 && q.every(Number.isFinite))) : [];
if (!polys.length) continue;
const o = polys[0][0];
const P = polys.map((p) => p.map((q) => [(q[0] - o[0]) * k, (q[1] - o[1]) * k, (q[2] - o[2]) * k]));
const name = String(spec.name || addon.manifest?.name || addon.id).replace(/[\u0000-\u001f]/g, ' ').slice(0, 60);
const d = meshDef(M, P, M.uniqueName(name));
if (!d.faces.size) { M.defs.delete(d.id); continue; }
if (Number(spec.smooth) > 0) softenEdges(d, [...d.edges.keys()], Math.min(60, Number(spec.smooth))); // round surfaces shade smooth
const iid = M.place(M.root, d.id, translation([o[0] * k, o[1] * k, o[2] * k]));