# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `plot`::`Polygon3d`

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::Polygon3d(`[pt3d1, pt3d2, …]`, <`a = amin .. amax`>, `options`)
plot::Polygon3d(`M3d`, <`a = amin .. amax`>, `options`)
```

## Description

`plot::Polygon3d` defines polygons in 3D by a given list of vertex points. A polygon consists of points and edges. The edges are made up of the lines traversing from the first to the second point, the second to the third point, and so on. The last point is automatically connected with the first point if the attribute `Closed` = `TRUE` is specified.

Points and lines can be hidden via `PointsVisible` = `FALSE` and `LinesVisible` = `FALSE`. By default, the vertex points are hidden, and the edges are visible.

All points as a whole can be manipulated via `PointStyle` and `PointSize`. The attribute `LineColor` sets the color for all points and all lines. Likewise all lines can be manipulated via `LineStyle` and `LineWidth`.

You can vary the color of all lines and points via `LineColorType`. The default value is `Flat`. Specifying the values `Dichromatic` or `Rainbow` lets you set the second color `LineColor2`. With `Functional`, the colors are taken from a custom `LineColorFunction`. See Example 2.

A 3D polygon can only be filled if it is defined by three vertices (a triangle). The attribute `Filled` = `TRUE` is ignored for other 3D polygons.

## Attributes

AttributePurposeDefault Value
`AffectViewingBox`influence of objects on the `ViewingBox` of a scene`TRUE`
`Closed`open or closed polygons`FALSE`
`Color`the main color`RGB::Blue`
`Filled`filled or transparent areas and surfaces`FALSE`
`FillColor`color of areas and surfaces`RGB::LightBlue`
`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::Blue`
`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
`Points3d`list of 3D points
`PointSize`the size of points`1.5`
`PointStyle`the presentation style of points`FilledCircles`
`PointsVisible`visibility of mesh points`FALSE`
`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 2

Plot a closed star-shaped 3D polygon with various color attributes:

```p := plot::Polygon3d( [([cos(PI*k/3), sin(PI*k/3), sin(PI*k/3)], [cos(PI*k/3 + PI/6)/2, sin(PI*k/3 + PI/6)/2, sin(PI*k/3 + PI/6)/2]) \$k = 1..6 ], Closed = TRUE): S1 := plot::Scene3d(p, LineColorType = Flat): S2 := plot::Scene3d(p, LineColorType = Dichromatic): S3 := plot::Scene3d(p, LineColorType = Dichromatic, LineColor = RGB::Blue, LineColor2 = RGB::Green): S4 := plot::Scene3d(p, LineColorType = Rainbow, LineColor = RGB::Blue, LineColor2 = RGB::Green): plot(S1, S2, S3, S4)```

Plot the same polygon while animating its line color using a color function. The result is a dazzling star:

```p := plot::Polygon3d( [([cos(PI*k/3), sin(PI*k/3), sin(PI*k/3)], [cos(PI*k/3 + PI/6)/2, sin(PI*k/3 + PI/6)/2, sin(PI*k/3 + PI/6)/2]) \$k = 1..6 ], Closed = TRUE, LineColorFunction = proc(x, y, z, i, a) begin [sin(x + a*i)^2, sin(y + a*i)^2, sin(z + a*i)^2]: end_proc, a = 0..10): plot(p)```

`delete p, S1, S2, S3, S4`

## Parameters

 ```pt3d1, pt3d2, …``` The 3D vertices. These must not be of type `plot::Point3d`, but lists of three numerical real values or arithmetical expressions of the animation parameter `a` (the coordinates). `pt3d1`, `pt3d2`, … is equivalent to the attribute `Points3d`. `M3d` An array or a matrix with 3 columns. Each row provides the coordinates of one point. `M3d` is equivalent to the attribute `Points3d`. `a` Animation parameter, specified as `a```` = amin..amax```, where `amin` is the initial parameter value, and `amax` is the final parameter value.