I am attempting to use Three.js to build a unique irregular polyhedron. In order to achieve this, I have decided to utilize the PolyhedronGeometry
feature (refer to the documentation). However, I am encountering difficulty in understanding the concept of
indices — Array of indices that make up the faces of the form [0,1,2, 2,3,0, ... ]
This lack of clarity has resulted in my irregular tetrahedron, showcased in this JSfiddle, not having all its faces properly enclosed as intended.
Could someone please advise on how to rectify this issue?
Here is the current approach I am employing to create the tetrahedron:
var verticesOfCube = [-1,-1,-1, 1,-2.5,1, 1, 1,-1, -1, 1,-1];
var indicesOfFaces = [2,1,0, 0,3,2, 3,2,1, 1,3,0];
// geometry
var geometry = new THREE.PolyhedronGeometry( verticesOfCube, indicesOfFaces, 10, 0 );
// material
var material1 = new THREE.MeshPhongMaterial( {
color: 'sandybrown'
} );
// mesh
mesh = new THREE.Mesh( geometry, material1 );
mesh.position.set( 0, 0, 0 );
scene.add( mesh );