---
agentTools:
  projectIndex: https://whsjs.readme.io/llms.txt
---

# Polyhedron

[components / meshes / Polyhedron.js](https://github.com/WhitestormJS/whitestorm.js/blob/dev/src/framework/components/meshes/Polyhedron.js)

In elementary geometry, a **polyhedron** is *a solid in three dimensions with flat polygonal faces, straight edges and sharp corners or vertices*.

`WHS.Polyhedron` creates Polyhedron object by it's `radius` and `detail`.

[block:code]
{
  "codes": [
    {
      "code": "const polyhedron = new WHS.Polyhedron({\n  geometry: {\n    radius: 2,\n    detail: 1\n  },\n\n  material: new THREE.MeshBasicMaterial({\n    color: 0xffffff\n  }),\n\n  position: [0, 100, 0]\n});\n\npolyhedron.addTo(world);\n",
      "language": "javascript"
    }
  ]
}
[/block]

[block:api-header]
{
  "type": "basic",
  "title": "Parameters"
}
[/block]

### Geometry defaults

[block:code]
{
  "codes": [
    {
      "code": "{\n  // ...\n\n  geometry: {\n    verticesOfCube: verticesOfCube, // Array.\n    indicesOfFaces: indicesOfFaces, // Array.\n    radius: 6, // Number.\n    detail: 2 // Number.\n  }\n}\n",
      "language": "javascript"
    }
  ]
}
[/block]

> These defaults are additional, there are also defaults filled by `MeshComponent`, etc.

[block:api-header]
{
  "type": "basic",
  "title": "Instructions"
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "{\n  // ...\n\n  geometry: ['verticesOfCube', 'indicesOfFaces', 'radius', 'detail']\n}\n",
      "language": "javascript"
    }
  ]
}
[/block]