MCPcopy Create free account
hub / github.com/CNCKitchen/stlTexturizer / initQuadrics

Function initQuadrics

js/decimation.js:524–540  ·  view source on GitHub ↗
(quadrics, positions, faces, faceCount)

Source from the content-addressed store, hash-verified

522 for (let f = 0; f < faceCount; f++) {
523 if (faces[f * 3] < 0) continue;
524 for (let e = 0; e < 3; e++) {
525 const va = faces[f * 3 + e];
526 const vb = faces[f * 3 + ((e + 1) % 3)];
527 const lo = va < vb ? va : vb, hi = va < vb ? vb : va;
528 const ei = edgeIdx.getOrSet(lo, hi, 0, edgeCount);
529 if (edgeIdx.inserted) {
530 edgeVa[ei] = lo; edgeVb[ei] = hi; edgeF0[ei] = f; edgeNum[ei] = 1;
531 edgeCount++;
532 } else if (edgeNum[ei] === 1) {
533 edgeF1[ei] = f; edgeNum[ei] = 2;
534 } else {
535 // 3rd+ incidence: non-manifold edge — never feeds crease quadrics.
536 // (Until June 2026 a legacy Map-encoding quirk re-armed every EVEN
537 // incidence count as the bogus pair (face 0 of the whole mesh, latest
538 // face), injecting crease penalty planes derived from an unrelated
539 // triangle's normal into fold regions. Removing it was validated by
540 // RMS surface-distance comparison and edge-defect counts — see the
541 // commit message.)
542 edgeNum[ei] = 3;
543 }

Callers 1

decimateFunction · 0.85

Calls 1

addPlaneQFunction · 0.85

Tested by

no test coverage detected