plot::Hexahedron

Regular Hexahedra

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

plot::Hexahedron(<a = amin .. amax>, options)

Description

plot::Hexahedron() creates regular polyhedra.

Per default, all polyhedra are centered at the origin. The attribute Center allows to choose a different center. This is helpful to align the polyhedra relative to other objects in the graphical scene. Cf. Example 1.

All polyhedra fit into a box extending from -1 to 1 in all coordinate directions. Their size can be changed by the attribute Radius. In case of a hexahedron (a box), this attribute represents the radius of the inscribed sphere. For the other polyhedra, it is the radius of the circumscribed sphere.

The default value of Radius is 1 for all polyhedra.

Further to the attributes Center and Radius, you can modify the polyhedra by applying transformation objects of type plot::Rotate3d, plot::Scale3d, plot::Translate3d , and plot::Transform3d. Cf. Example 3.

User-defined color functions (LineColorFunction, FillColorFunction) are called with the index of the current facet as its first parameter, followed by the x, y, and z coordinate of the current point, followed by the current value of the animation parameter (if animated). Cf. Example 4.

Attributes

AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
Centercenter of objects, rotation center[0, 0, 0]
CenterXcenter of objects, rotation center, x-component0
CenterYcenter of objects, rotation center, y-component0
CenterZcenter of objects, rotation center, z-component0
Colorthe main colorRGB::Red
Filledfilled or transparent areas and surfacesTRUE
FillColorcolor of areas and surfacesRGB::Red
FillColor2second color of areas and surfaces for color blendsRGB::CornflowerBlue
FillColorTypesurface filling typesDichromatic
FillColorFunctionfunctional area/surface coloring
FillColorDirectionthe direction of color transitions on surfaces[0, 0, 1]
FillColorDirectionXx-component of the direction of color transitions on surfaces0
FillColorDirectionYy-component of the direction of color transitions on surfaces0
FillColorDirectionZz-component of the direction of color transitions on surfaces1
Framesthe number of frames in an animation50
Legendmakes a legend entry
LegendTextshort explanatory text for legend
LegendEntryadd this object to the legend?FALSE
LineColorcolor of linesRGB::Black.[0.25]
LineWidthwidth of lines0.35
LineColor2color of linesRGB::DeepPink
LineStylesolid, dashed or dotted lines?Solid
LinesVisiblevisibility of linesTRUE
LineColorTypeline coloring typesFlat
LineColorFunctionfunctional line coloring
LineColorDirectionthe direction of color transitions on lines[0, 0, 1]
LineColorDirectionXx-component of the direction of color transitions on lines0
LineColorDirectionYy-component of the direction of color transitions on lines0
LineColorDirectionZz-component of the direction of color transitions on lines1
Namethe name of a plot object (for browser and legend)
ParameterEndend value of the animation parameter
ParameterNamename of the animation parameter
ParameterBegininitial value of the animation parameter
ParameterRangerange of the animation parameter
PointSizethe size of points1.5
PointStylethe presentation style of pointsFilledCircles
PointsVisiblevisibility of mesh pointsFALSE
TimeEndend time of the animation10.0
TimeBeginstart time of the animation0.0
TimeRangethe real time span of an animation0.0 .. 10.0
Titleobject title
TitleFontfont of object titles[" sans-serif ", 11]
TitlePositionposition of object titles
TitleAlignmenthorizontal alignment of titles w.r.t. their coordinatesCenter
TitlePositionXposition of object titles, x component
TitlePositionYposition of object titles, y component
TitlePositionZposition of object titles, z component
VisiblevisibilityTRUE
VisibleAfterobject visible after this time value
VisibleBeforeobject visible until this time value
VisibleFromToobject visible during this time range
VisibleAfterEndobject visible after its animation time ended?TRUE
VisibleBeforeBeginobject visible before its animation time starts?TRUE

Examples

Example 1

Using different Centers, the five regular polyhedra are placed side by side:

plot(plot::Hexahedron  (Center = [0, 0, 0]),
plot::Tetrahedron (Center = [3, 0, 0]),
plot::Octahedron  (Center = [6, 0, 0]),
plot::Icosahedron (Center = [9, 0, 0]),
plot::Dodecahedron(Center = [12, 0, 0]),
Axes = Frame);

With the attribut Radius, the size of the polyhydra can be changed:

plot(plot::Hexahedron  (Radius = 1.0, Center = [0, 0, 0]),
plot::Tetrahedron (Radius = 1.5, Center = [4, 0, 0]),
plot::Octahedron  (Radius = 2.0, Center = [8, 0, 0]),
plot::Icosahedron (Radius = 2.5, Center = [13, 0, 0]),
plot::Dodecahedron(Radius = 3.0, Center = [19, 0, 0]),
Axes = Frame);

Example 2

A tetrahedron and an octahedron are embedded in a hexahedron:

plot(plot::Hexahedron (FillColorFunction = RGB::Red.[0.2],
VisibleFromTo = 0..8),
plot::Tetrahedron(FillColorFunction = RGB::Green.[0.2],
VisibleFromTo = 1..5),
plot::Octahedron (FillColorFunction = RGB::Blue.[0.2],
VisibleFromTo = 3..7),
Axes = None)

Example 3

Transformation objects can be applied to polyhedra as demonstrated below:

H := plot::Hexahedron(Color = RGB::Blue.[0.2],
FillColorType = Flat):
T := plot::Tetrahedron(Color = RGB::Red):
plot(plot::Rotate3d(a, [0, 0, 0], [0, 0, 1], a = 0..2*PI,
H,
plot::Translate3d([0, 0, a], T, a = 0..2)
), Axes = None)

delete T, H:

Example 4

A FillColorFunction can be specified. This will be called with the index of the current facet as its first parameter, followed by the x-, y- and z-coordinate of the current point:

mycolorlist := [RGB::Red, RGB::Blue, RGB::Green, RGB::Yellow]:
plot(plot::Dodecahedron(Center = [0, 0, 0],
FillColorFunction =
proc(n, x, y, z) begin
[(1 + x)/2, (1 + y)/2, (1 + z)/2]
end_proc),
plot::Dodecahedron(Center = [3, 0, 0],
FillColorFunction =
proc(n, x, y, z) begin
mycolorlist[(n mod 4)+1]
end_proc),
Axes = None):

The same holds true for a LineColorFunction:

plot(plot::Icosahedron(Center = [0, 0, 0],
LineColorFunction =
proc(n, x, y, z) begin
[(1 + x)/2, (1 + y)/2, (1 + z)/2]
end_proc),
plot::Icosahedron(Center = [3, 0, 0],
LineColorFunction =
proc(n, x, y, z) begin
mycolorlist[(n mod 4)+1]
end_proc),
Axes = None, LineWidth = 1.0*unit::mm,
FillColor = RGB::Grey80, FillColorType = Flat):

If the polyhedron is animated, the color functions are called with an additional argument: the current value of the animation parameter:

plot(plot::Octahedron(FillColorFunction =
proc(n, x, y, z, a)
begin
[sin(n*a)^2, cos(n*a)^2, 1]:
end_proc,
a = 0..2*PI))

delete mycolorlist:

Algorithms

A polyhedron is called regular if all its facets consist of the same regular polygon and each vertex has the same number of coincidence polygons.

Since Plato we know that only five regular polyhedrons exist:

• the tetrahedron with 4 (greek tetra) triangles,

• the hexahedron with 6 (greek hexa) squares,

• the octahedron with 8 (greek okta) triangles,

• the dodecahedron with 12 (greek dodeka) pentagons and

• the icosahedron with 20 (greek eikosi) triangles.

The following table lists some important geometrical data of the polyhedra with the edge length a. Where R is the radius of the outer spherem r the radius of the inner sphere, A the surface area and V the volume:

RatioTetrahedronHexahedronOctahedronDodecahedronIcosahedron
6
1