Menu - Top - Home - Donate to Me

module:extras/polyhedra.Polyhedra

Back to documentation index.

new module:extras/polyhedra.Polyhedra()

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

Methods

(static) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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) module:extras/polyhedra~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.