# `plot`::`Cone`

Cones and frustums

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::Cone(`br`, `[bx, by, bz]`, <`tr`>, `[tx, ty, tz]`, <`a = amin .. amax`>, `options`)
```

## Description

```plot::Cone(br, [ bx, by, bz], [ tx, ty, tz])``` creates a cone stretching from the base with radius `br` and center ```[bx, by, bz]``` to the top ```[tx, ty, tz]```.

```plot::Cone(br, [ bx, by, bz], tr, [ tx, ty, tz])``` creates a conical frustum from the base center ```[bx, by, bz]``` to the top center ```[tx, ty, tz]```. The base radius is `br`, the top radius is `tr`.

The lower center and upper center of the cone can also be passed as vectors.

The optional “top radius” `tr` for creating a frustum may also be specified as the attribute ```TopRadius = tr```.

The upper and lower faces of a cone/frustum are not filled. They can be added as filled `plot::Circle3d`s.

Note that only circular cones can be created with `plot::Cone`. For elliptical bases, use a `plot::Surface` primitive or apply a `plot::Scale3d` transformation.

## Attributes

AttributePurposeDefault Value
`AffectViewingBox`influence of objects on the `ViewingBox` of a scene`TRUE`
`Base`base center of cones, cylinders, pyramids and prisms[`0`, `0`, `0`]
`BaseX`x-coordinate of top center of cones, cylinders, pyramids and prisms`0`
`BaseY`y-coordinate of top center of cones, cylinders, pyramids and prisms`0`
`BaseZ`z-coordinate of top center of cones, cylinders, pyramids and prisms`0`
`BaseRadius`base radius of cones/conical frustums and pyramids/frustums of pyramids`1`
`Color`the main color`RGB::LightBlue`
`Filled`filled or transparent areas and surfaces`TRUE`
`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::Black.[0.25]`
`LineWidth`width of lines`0.35`
`LineStyle`solid, dashed or dotted lines?`Solid`
`LinesVisible`visibility of lines`TRUE`
`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`
`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
`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
`Top`top center of cones, cylinders, pyramids and prisms[`0`, `0`, `1`]
`TopX`base and top center of cones, cylinders, pyramids and prisms`0`
`TopY`base and top center of cones, cylinders, pyramids and prisms`0`
`TopZ`base and top center of cones, cylinders, pyramids and prisms`1`
`TopRadius`top radius of cones/conical frustums and pyramids/frustums of pyramids`0`
`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

We draw a cone with base radius 6:

`plot(plot::Cone(6, [0, 0, 0], [0, 0, 10])):`

### Example 2

We create a conical frustum by specifying a non-zero top radius. Note that no discs are attached to the base and the top. You can look through the frustum:

```br := 16: base := [3, 4, 5]: tr:= 7: top := [11, 12, 13]: plot(plot::Cone(br, base, tr, top, FillColor = RGB::Red)):```

We add the discs at the base and the top. Their normals `n` are given as the vector from the base to the top:

```n := zip(top, base, _subtract): plot(plot::Circle3d(br, base, n, Filled = TRUE), plot::Circle3d(tr, top, n, Filled = TRUE), plot::Cone(br, base, tr, top), LinesVisible = FALSE, FillColor = RGB::Red):```

`delete br, base, tr, top, n:`

### Example 3

A tube or cylinder (in the mathematical sense, i.e., the lateral sides of a physical cylinder) is a special case of a conical frustum with the same top and bottom radius:

```plot(plot::Cone(6, [0, 0, 0], 6, [11, 12, 13], FillColor = RGB::Yellow, LinesVisible = TRUE)):```

### Example 4

Bottom and top radii and centers can be animated:

```plot(plot::Cone(sin(a)^2, [sin(2*a), cos(2*a), 0], cos(a)^2, [cos(2*a), sin(2*a), 1], a = 0..PI, FillColor = RGB::Green)):```

## Parameters

 `br` The base radius of the cone. This must be a real numerical value or an arithmetical expression of the animation parameter `a`. `br` is equivalent to the attribute `BaseRadius`. `bx`, `by`, `bz` The lower center point. The coordinates `bx`, `by`, `bz` must be real numerical values or arithmetical expressions of the animation parameter `a`. `bx`, `by`, `bz` are equivalent to the attributes `BaseX`, `BaseY`, `BaseZ`. `tr` The top radius of the cone/conical frustum. This must be a real numerical value or an arithmetical expression of the animation parameter `a`. If no top radius is specified, a cone with top radius tr = 0 is created. `tr` is equivalent to the attribute `TopRadius`. `tx`, `ty`, `tz` The upper center point. The coordinates `tx`, `ty`, `tz` must be real numerical values orarithmetical expressions of the animation parameter `a`. `tx`, `ty`, `tz` are equivalent to the attributes `TopX`, `TopY`, `TopZ`. `a` Animation parameter, specified as `a```` = amin..amax```, where `amin` is the initial parameter value, and `amax` is the final parameter value.