# `plot`::`Box`

Boxes in 3D

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::Box(`xmin .. xmax`, `ymin .. ymax`, `zmin .. zmax`, <`a = amin .. amax`>, `options`)
plot::Box(`[xmin, ymin, zmin]`, `[xmax, ymax, zmax]`, <`a = amin .. amax`>, `options`)
```

## Description

```plot::Box(`x_{min}`..`x_{max}`, `y_{min}`..`y_{max}`, `z_{min}`..`z_{max}`)``` creates the 3D box

.

```plot::Box([xmin, ymin, zmin], [xmax, ymax, zmax])``` produces the same box.

`plot::Box` creates 3D boxes with edges parallel to the coordinate axes. Using `plot::Rotate3d` or `plot::Transform3d` one can create boxes and parallelepipeds with arbitrary orientation. Cf. examples Example 3 and Example 4.

## Attributes

AttributePurposeDefault Value
`AffectViewingBox`influence of objects on the `ViewingBox` of a scene`TRUE`
`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
`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`
`XMax`final value of parameter “x”`1`
`XMin`initial value of parameter “x”`-1`
`XRange`range of parameter “x”`-1` .. `1`
`YMax`final value of parameter “y”`1`
`YMin`initial value of parameter “y”`-1`
`YRange`range of parameter “y”`-1` .. `1`
`ZMax`final value of parameter “z”`1`
`ZMin`initial value of parameter “z”`-1`
`ZRange`range of parameter “z”`-1` .. `1`

## Examples

### Example 1

We draw a box consisting of its edges and a filled box:

```plot(plot::Box(-3..-1, 0..2, 0..1, Filled = FALSE, LineColor = RGB::Black), plot::Box(1..3, 0..2, 0..1, Filled = TRUE, FillColor = RGB::Red), Axes = None, Scaling = Constrained)```

### Example 2

The borders of a box can be animated:

`plot(plot::Box([1, 1, 1], [2, 2, 2 + sin(r)], r = 0..2*PI)):`

### Example 3

We want to display a cube “standing” on one of its corners. First, we define the cube:

`b0 := plot::Box(0..1, 0..1, 0..1)`

Now, rotating the cube to stand on a corner is equivalent to first rotating around the x-axis by 45 degrees, then rotating around the y-axis:

```b1 := plot::Rotate3d(b0, Axis = [1, 0, 0], Angle = -PI/4): plot(b1, Scaling = Constrained)```

```b2 := plot::Rotate3d(b1, Axis = [0, 1, 0], Angle = 7*PI/36): plot(b2, Scaling = Constrained)```

Finally, we let it rotate around the z-axis:

```plot(plot::Rotate3d(b2, Axis = [0, 0, 1], Angle = a, a = 0..2*PI/3), Scaling = Constrained)```

`delete b0, b1, b2:`

### Example 4

A parallelepiped can be obtained from a `plot::Box` by a linear transformation:

```plot(plot::Transform3d([0, 0, 0], [1, 1, 0, 1, 1, 3, 0, 3, 1], plot::Box(0..1, 0..1, 0..1)), Scaling = Constrained, CameraDirection = [-27, -12, 22])```

## Parameters

 `xmin`, `ymin`, `zmin` The lower borders: numerical real values or arithmetical expressions of the animation parameter `a`. `xmin`, `ymin`, `zmin` are equivalent to the attributes `XMin`, `YMin`, `ZMin`. `xmax`, `ymax`, `zmax` The upper borders: numerical real values or arithmetical expressions of the animation parameter `a`. `xmax`, `ymax`, `zmax` are equivalent to the attributes `XMax`, `YMax`, `ZMax`. `a` Animation parameter, specified as `a```` = amin..amax```, where `amin` is the initial parameter value, and `amax` is the final parameter value.