@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
21 lines (19 loc) • 641 B
JavaScript
/**
* Vertices must be unique inside a single tetrahedron, that is - no repetitions are allowed
* If vertices are repeated - volume will be 0 and tetrahedron will be degenerate
* @param {TetrahedralMesh} mesh
* @param {number} tet
* @returns {boolean}
*/
export function is_tetrahedron_degenerate(mesh, tet) {
for (let i0 = 0; i0 < 4; i0++) {
const v0 = mesh.getVertexIndex(tet, i0);
for (let i1 = i0 + 1; i1 < 4; i1++) {
if (v0 === mesh.getVertexIndex(tet, i1)) {
// identical vertices
return true;
}
}
}
return false;
}