I’ve been able to reproduce the picture except the tetrahedra (i.e. I got the edges fine).
I do:
......
// an empty tetrahedron
const fourVertices = [
0, 0, 0,
0, 0, 0,
0, 0, 0,
0, 0, 0
];
const faces = [
2, 1, 0,
0, 3, 2,
1, 3, 0,
2, 3, 1
];
let cell = new THREE.PolyhedronGeometry(fourVertices, faces);
cell.setAttribute(
"position",
new THREE.Float32BufferAttribute(fourVertices, 3)
);
......
and:
......
for(let i = 0; i < ntetrahedra; i++) {
let mesh = new THREE.Mesh(cell, cellMaterial);
mesh.geometry.attributes.position.needsUpdate = true;
Meshes_tetrahedra[i] = mesh;
group.add(mesh);
}
......
and in the animate
function:
......
for(let t = 0; t < ntetrahedra; t++) {
let mesh = Meshes_tetrahedra[t];
let tetrahedron = tetrahedra[t];
let cellVertices = new Array(0);
for(let i = 0; i < 4; i++) {
let vi = vertices3d[tetrahedron[i]];
cellVertices.push(vi.x, vi.y, vi.z);
}
mesh.geometry.setAttribute(
"position", new THREE.Float32BufferAttribute(cellVertices, 3)
);
mesh.geometry.computeBoundingBox();
mesh.geometry.computeBoundingSphere();
}
Only one face of one tetrahedron appears. What am I missing?