`plot`::`Octahedron`

Regular Octahedra

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::Octahedron(<`a = amin .. amax`>, `options`)
```

Description

`plot::Octahedron()` 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
`AffectViewingBox`influence of objects on the `ViewingBox` of a scene`TRUE`
`Center`center of objects, rotation center[`0`, `0`, `0`]
`CenterX`center of objects, rotation center, x-component`0`
`CenterY`center of objects, rotation center, y-component`0`
`CenterZ`center of objects, rotation center, z-component`0`
`Color`the main color`RGB::Red`
`Filled`filled or transparent areas and surfaces`TRUE`
`FillColor`color of areas and surfaces`RGB::Red`
`FillColor2`second color of areas and surfaces for color blends`RGB::CornflowerBlue`
`FillColorType`surface filling types`Dichromatic`
`FillColorFunction`functional area/surface coloring
`FillColorDirection`the direction of color transitions on surfaces[`0`, `0`, `1`]
`FillColorDirectionX`x-component of the direction of color transitions on surfaces`0`
`FillColorDirectionY`y-component of the direction of color transitions on surfaces`0`
`FillColorDirectionZ`z-component of the direction of color transitions on surfaces`1`
`Frames`the number of frames in an animation`50`
`Legend`makes a legend entry
`LegendText`short explanatory text for legend
`LegendEntry`add this object to the legend?`FALSE`
`LineColor`color of lines`RGB::Black.[0.25]`
`LineWidth`width of lines`0.35`
`LineColor2`color of lines`RGB::DeepPink`
`LineStyle`solid, dashed or dotted lines?`Solid`
`LinesVisible`visibility of lines`TRUE`
`LineColorType`line coloring types`Flat`
`LineColorFunction`functional line coloring
`LineColorDirection`the direction of color transitions on lines[`0`, `0`, `1`]
`LineColorDirectionX`x-component of the direction of color transitions on lines`0`
`LineColorDirectionY`y-component of the direction of color transitions on lines`0`
`LineColorDirectionZ`z-component of the direction of color transitions on lines`1`
`Name`the name of a plot object (for browser and legend)
`ParameterEnd`end value of the animation parameter
`ParameterName`name of the animation parameter
`ParameterBegin`initial value of the animation parameter
`ParameterRange`range of the animation parameter
`PointSize`the size of points`1.5`
`PointStyle`the presentation style of points`FilledCircles`
`PointsVisible`visibility of mesh points`FALSE`
`Radius`radius of circles, spheres etc.`1`
`Shading`smooth color blend of surfaces`Smooth`
`TimeEnd`end time of the animation`10.0`
`TimeBegin`start time of the animation`0.0`
`TimeRange`the real time span of an animation`0.0` .. `10.0`
`Title`object title
`TitleFont`font of object titles[`" sans-serif "`, `11`]
`TitlePosition`position of object titles
`TitleAlignment`horizontal alignment of titles w.r.t. their coordinates`Center`
`TitlePositionX`position of object titles, x component
`TitlePositionY`position of object titles, y component
`TitlePositionZ`position of object titles, z component
`Visible`visibility`TRUE`
`VisibleAfter`object visible after this time value
`VisibleBefore`object visible until this time value
`VisibleFromTo`object visible during this time range
`VisibleAfterEnd`object visible after its animation time ended?`TRUE`
`VisibleBeforeBegin`object visible before its animation time starts?`TRUE`

Examples

Example 1

Using different `Center`s, 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

Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos