Polyhedra

Back to documentation index.

### Polyhedra()

Contains helper methods for generating the five platonic solids and other polyhedra.

Methods

### (static) Polyhedra.dodecahedron(radius, level)

Generates a mesh of a regular dodecahedron or a sphere based on that solid.

Parameters

Return Value

The generated solid. (Type: MeshBuffer)

### (static) Polyhedra.dodecahedronFaces()

Gets the vertices of a dodecahedron with maximum radius 1.

Return Value

A two-element array. The first element contains an array of the vertices that make up the solid (each vertex’s X, Y, and Z coordinates are stored as three elements of that array), and the second element contains an array of vertex indices (multiplying each element by 3 will get the index to the first coordinate of the corresponding vertex in the first array). (Type: Array.<Array.<number»)

### (static) Polyhedra.dodecahedronFacesCompact()

Gets a more compact representation of the vertices of a dodecahedron with maximum radius 1.

Return Value

A two-element array. The first element contains an array of the vertices that make up the solid (each vertex’s X, Y, and Z coordinates are stored as three elements of that array), and the second element contains an array of vertex indices (multiplying each element by 3 will get the index to the first coordinate of the corresponding vertex in the first array). (Type: Array.<Array.<number»)

### (static) Polyhedra.hexahedron(radius, level)

Generates a mesh of a regular hexahedron (cube) or a sphere based on that solid.

Parameters

Return Value

The generated solid. (Type: MeshBuffer)

### (static) Polyhedra.hexahedronFaces()

Gets the vertices of a hexahedron (cube) with maximum radius 1.

Return Value

A two-element array. The first element contains an array of the vertices that make up the solid (each vertex’s X, Y, and Z coordinates are stored as three elements of that array), and the second element contains an array of vertex indices (multiplying each element by 3 will get the index to the first coordinate of the corresponding vertex in the first array). (Type: Array.<Array.<number»)

### (static) Polyhedra.hexahedronFacesCompact()

Gets a more compact representation of the vertices of a hexahedron (cube) with maximum radius 1.

Return Value

A two-element array. The first element contains an array of the vertices that make up the solid (each vertex’s X, Y, and Z coordinates are stored as three elements of that array), and the second element contains an array of vertex indices (multiplying each element by 3 will get the index to the first coordinate of the corresponding vertex in the first array). (Type: Array.<Array.<number»)

### (static) Polyhedra.icosahedron(radius, level)

Generates a mesh of a regular icosahedron or a sphere based on that solid.

Parameters

Return Value

The generated solid. (Type: MeshBuffer)

### (static) Polyhedra.icosahedronFaces()

Gets the vertices of a regular icosahedron with maximum radius 1.

Return Value

A two-element array. The first element contains an array of the vertices that make up the solid (each vertex’s X, Y, and Z coordinates are stored as three elements of that array), and the second element contains an array of vertex indices (multiplying each element by 3 will get the index to the first coordinate of the corresponding vertex in the first array). (Type: Array.<Array.<number»)

### (static) Polyhedra.makeSphere(vi, radius, level)

Modifies the vertices and indices of a solid to generate an approximation of a sphere.

Parameters

Return Value

The “vi” parameter, which will likely be modified. (Type: Array.<Array.<number»)

### (static) Polyhedra.normDistances(vertices, radius)

Normalizes the distance from the origin to each vertex in the given array to a fixed radius.

Parameters

Return Value

Return value. (Type: Object)

### (static) Polyhedra.octahedron(radius, level)

Generates a mesh of a regular octahedron or a sphere based on that solid.

Parameters

Return Value

The generated solid. (Type: MeshBuffer)

### (static) Polyhedra.octahedronFaces()

Gets the vertices of a regular octahedron with radius 1.

Return Value

A two-element array. The first element contains an array of the vertices that make up the solid (each vertex’s X, Y, and Z coordinates are stored as three elements of that array), and the second element contains an array of vertex indices (multiplying each element by 3 will get the index to the first coordinate of the corresponding vertex in the first array). (Type: Array.<Array.<number»)

### (static) Polyhedra.tetrahedron(radius, level)

Generates a mesh of a regular tetrahedron or a sphere based on that solid.

Parameters

Return Value

The generated solid. (Type: MeshBuffer)

### (static) Polyhedra.tetrahedronFaces()

Gets the vertices of a tetrahedron with radius 1.

Return Value

A two-element array. The first element contains an array of the vertices that make up the solid (each vertex’s X, Y, and Z coordinates are stored as three elements of that array), and the second element contains an array of vertex indices (multiplying each element by 3 will get the index to the first coordinate of the corresponding vertex in the first array). (Type: Array.<Array.<number»)

Back to documentation index.