Skip to Main Content Skip to Search
Product Documentation

plot::Boxboxes in 3D

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

ImageSet(matrix([[x, y, z]]), (x_min <= x) <= x_max, (y_min <= y) <= y_max, (z_min <= z) <= z_max)`.`

plot::Box([`x_{min}`, `y_{min}`, `z_{min}`], [`x_{max}`, `y_{max}`, `z_{max}`]) produces the same box.

→ Examples

Calls:

plot::Box(`x_{min}` .. `x_{max}`, `y_{min}` .. `y_{max}`, `z_{min}` .. `z_{max}`, <a = amin .. amax>, Options)

plot::Box([`x_{min}`, `y_{min}`, `z_{min}`], [`x_{max}`, `y_{max}`, `z_{max}`], <a = amin .. amax>, Options)

Parameters:

`x_{min}`, `y_{min}`, `z_{min}`

the lower borders: numerical real values or arithmetical expressions of the animation parameter a
`x_{min}`, `y_{min}`, `z_{min}` are equivalent to the attributes XMin, YMin, ZMin.

`x_{max}`, `y_{max}`, `z_{max}`

the upper borders: numerical real values or arithmetical expressions of the animation parameter a
`x_{max}`, `y_{max}`, `z_{max}` are equivalent to the attributes XMax, YMax, ZMax.

Related Domains:

plot::Polygon3d, plot::Rotate3d, plot::Scale3d, plot::Surface, plot::Transform3d

Related Functions:

plot, plot::copy

Details:

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 3 and 4.

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)

MuPAD graphics

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)):

MuPAD graphicsimage

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)

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)

MuPAD graphics

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

MuPAD graphics

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)

MuPAD graphicsimage

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])

MuPAD graphics

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS