A polyhedron is a solid in three dimensions with flat faces. This class will take an array of vertices, project them onto a sphere, and then divide them up to the desired level of detail. This class is used by IcosahedronGeometry to generate its geometry.
const verticesOfCube = [
-1,-1,-1, 1,-1,-1, 1, 1,-1, -1, 1,-1,
-1,-1, 1, 1,-1, 1, 1, 1, 1, -1, 1, 1,
];
const indicesOfFaces = [
2, 1, 0, 0, 3, 2,
0, 4, 7, 7, 3, 0,
0, 1, 5, 5, 4, 0,
1, 2, 6, 6, 5, 1,
2, 3, 7, 7, 6, 2,
4, 5, 6, 6, 7, 4
];
const geometry = new v3d.PolyhedronGeometry(verticesOfCube, indicesOfFaces, 2, 2);
const material = new v3d.MeshStandardMaterial({ color: 0x00ff00 });
const polyhedron = new v3d.Mesh(geometry, material);
app.scene.add(polyhedron);
Procedural geometry is fun. However, in real life applications this feature is rarely needed. It would be more efficient do design polyhedrons in the preferred modelling suite and export/load to Verge3D via glTF.
See the base BufferGeometry class for common properties.
An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
See the base BufferGeometry class for common methods.
For more info on how to obtain the source code of this module see this page.