Axis
, AxisX
, AxisY
, AxisZ
Rotation axis
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.
Objects | Default Values |
---|---|
plot::Rotate3d |
|
Axis
is a vector determining the direction
of the rotation axis in rotation objects of type plot::Rotate3d
.
It is given by a list of 3 components.
AxisX
etc. refer to the x, y, z components
of this vector.
A rotation in 3D is determined by a line around which is rotated.
The line is given by a point on the line (the Center
) and a direction
vector (the Axis
). The rotation angle is given
by the attribute Angle
.
The length of the Axis
vector is of no relevance.
However, it should not be zero.
The rotation is implemented following the “right hand
rule”: Stretch the thumb of your right hand and bend the fingers.
When the thumb points into the direction of the rotation axis, your
finger tips indicate the direction of the rotation. Use negative angles
to rotate in the opposite direction or replace the Axis
vector
by its negative.
A cone is first rotated around the x-axis. The rotated cone is then rotated around the z-axis:
c0 := plot::Cone(1, [0, 0, 1], [0, 0, 2]): c1 := plot::Rotate3d(c0, Center = [0, 0, 0], Axis = [1, 0, 0], Angle = PI/2): c2 := plot::Rotate3d(c1, Center = [0, 0, 0], Axis = [0, 0, 1], Angle = PI/2): plot(plot::Scene3d(c0, Axes = Origin, ViewingBox = [-2..2, -2..2, -2..2]), plot::Scene3d(c1, Axes = Origin, ViewingBox = [-2..2, -2..2, -2..2]), plot::Scene3d(c2, Axes = Origin, ViewingBox = [-2..2, -2..2, -2..2]), TicksNumber = None, Width = 120*unit::mm, Height = 40*unit::mm, Layout = Horizontal):
delete c0, c1, c2:
We illustrate the “right hand rule”. A small box b0
is
rotated. The rotated copies b1
, b2
, b3
are
plotted together with the original box:
center := [1, 4, 1]: axis := [0, 0, 1]: b0 := plot::Box(0.9..1.1, 2.9 .. 3.1, 0.9 .. 1.1): b1 := plot::Rotate3d(b0, Center = center, Axis = axis, Angle = PI/8): b2 := plot::Rotate3d(b1, Center = center, Axis = axis, Angle = PI/8): b3 := plot::Rotate3d(b2, Center = center, Axis = axis, Angle = PI/8): centerplusaxis := [center[i] + axis[i] $ i = 1..3]: plot(b0, b1, b2, b3, plot::Arrow3d([0, 0, 0], center, Color = RGB::Black, Title = "Center", TitlePosition = [0.1, 2, 0.5]), plot::Arrow3d(center, centerplusaxis, Title = "Axis", Color = RGB::Red, TitlePosition = [0.7, 4, 1.5]), plot::Circle3d(1, center, axis), plot::Rotate3d(plot::Arrow3d([0, 4, 1], [0, 3.9, 1], Color = RGB::Blue), Axis = axis, Center = center, Angle = 0.43*PI + a*2*PI/3) $ a = 1..3, Axes = Origin ):
delete center, axis, b0, b1, b2, b3, centerplusaxis: