Menu - Top - Home - Donate to Me

H3DU.Polyhedra

Back to documentation index.

H3DU.Polyhedra()

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

To use this class, you must include the script "extras/polyhedra.js"; the class is not included in the "h3du_min.js" file which makes up the HTML 3D Library. Example:

<script type="text/javascript" src="extras/polyhedra.js"></script>

Methods

(static) H3DU.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: H3DU.MeshBuffer)

(static) H3DU.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) H3DU.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) H3DU.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: H3DU.MeshBuffer)

(static) H3DU.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) H3DU.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) H3DU.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: H3DU.MeshBuffer)

(static) H3DU.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) H3DU.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) H3DU.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) H3DU.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: H3DU.MeshBuffer)

(static) H3DU.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) H3DU.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: H3DU.MeshBuffer)

(static) H3DU.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.