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
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
Colorthe main colorRGB::LightBlue
Filledfilled or transparent areas and surfacesTRUE
FillColorcolor of areas and surfacesRGB::LightBlue
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
LineStylesolid, dashed or dotted lines?Solid
LinesVisiblevisibility of linesTRUE
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
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 
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
XMaxfinal value of parameter “x”1
XMininitial value of parameter “x”-1
XRangerange of parameter “x”-1 .. 1
YMaxfinal value of parameter “y”1
YMininitial value of parameter “y”-1
YRangerange of parameter “y”-1 .. 1
ZMaxfinal value of parameter “z”1
ZMininitial value of parameter “z”-1
ZRangerange 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.

See Also

MuPAD Functions

MuPAD Graphical Primitives