Library polyhedra implements functions which create solid shapes with polygonal facesin 3D. Solids are displayed with plotpoly. They are defined by the coordinates of their vertices and by the list of vertex indices for each face. Other solids, such as cylinder and sphere, are generated with parametric equations and displayed with surf. Some solids have parameters, e.g. for the number of discrete values used for parameters. When called without output argument, with an optional trailing string argument for the edge style, the solid is displayed with the current scaling and color map. With output arguments, arrays X, Y, Z expected by surf, mesh and plotpoly, and index array expected by plotpoly, are produced. They can be modified to move, scale or stretch the solids.
The following statement makes available functions defined in polyhedra:
use polyhedra
Create a cube.
use polyhedra cube; cube(style); (X, Y, Z, ind) = cube
Without output argument, cube displays a cube, i.e. a convex solid whose six faces are squares. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, cube produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.
tetrahedron, octahedron, dodecahedron, icosahedron, plotpoly
Create a regular dodecahedron.
use polyhedra dodecahedron; dodecahedron(style); (X, Y, Z, ind) = dodecahedron
Without output argument, dodecahedron displays a regular convex dodecahedron, i.e. a convex solid whose twelve faces are regular pentagons. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, dodecahedron produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.
tetrahedron, cube, octahedron, icosahedron, greatdodecahedron, greatstellateddodecahedron, smallstellateddodecahedron, plotpoly
Create a great dodecahedron.
use polyhedra greatdodecahedron; greatdodecahedron(style); (X, Y, Z, ind) = greatdodecahedron
Without output argument, greatdodecahedron displays a great dodecahedron, i.e. a regular nonconvex solid whose twelve faces are regular pentagons. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, greatdodecahedron produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.
dodecahedron, greatstellateddodecahedron, greaticosahedron, plotpoly
Create a great dodecahedron.
use polyhedra greaticosahedron; greaticosahedron(style); (X, Y, Z, ind) = greaticosahedron
Without output argument, greaticosahedron displays a great icosahedron, i.e. a regular nonconvex solid whose twenty faces are equilateral triangles. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, greaticosahedron produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.
icosahedron, greatdodecahedron, plotpoly
Create a great stellated dodecahedron.
use polyhedra greatstellateddodecahedron; greatstellateddodecahedron(style); (X, Y, Z, ind) = greatstellateddodecahedron
Without output argument, greatstellateddodecahedron displays a great stellated dodecahedron, i.e. a regular nonconvex solid whose twelve faces are regular star pentagons and where each vertex is common to three faces. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, greatstellateddodecahedron produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.
dodecahedron, greatdodecahedron, smallstellateddodecahedron, plotpoly
Create a regular icosahedron.
use polyhedra icosahedron; icosahedron(style); (X, Y, Z, ind) = icosahedron
Without output argument, icosahedron displays a regular convex icosahedron, i.e. a convex solid whose twenty faces are equilateral triangles. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, icosahedron produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.
tetrahedron, cube, octahedron, dodecahedron, plotpoly
Create a regular octahedron.
use polyhedra octahedron; octahedron(style); (X, Y, Z, ind) = octahedron
Without output argument, octahedron displays a regular octahedron, i.e. a convex solid whose eight faces are equilateral triangles. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, octahedron produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.
tetrahedron, cube, dodecahedron, icosahedron, plotpoly
Create a small stellated dodecahedron.
use polyhedra smallstellateddodecahedron; smallstellateddodecahedron(style); (X, Y, Z, ind) = smallstellateddodecahedron
Without output argument, smallstellateddodecahedron displays a small stellated dodecahedron, i.e. a regular nonconvex solid whose twelve faces are regular star pentagons and where each vertex is common to five faces. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, smallstellateddodecahedron produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.
dodecahedron, greatdodecahedron, greatstellateddodecahedron, plotpoly
Create a regular tetrahedron.
use polyhedra tetrahedron; tetrahedron(style); (X, Y, Z, ind) = tetrahedron
Without output argument, tetrahedron displays a regular tetrahedron, i.e. a solid whose four faces are equilateral triangles. By default, edges are not drawn. An optional string input argument specifies the edge style.
With four output arguments, tetrahedron produces the X, Y, Z and ind arrays expected by plotpoly, and it does not display anything.