This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Rotations of 3D objects

MuPAD® notebooks are not recommended. 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.


plot::Rotate3d(angle, <[cx, cy, cz], [dx, dy, dz]>, obj1, <obj2, …>, <a = amin .. amax>, options)


plot::Rotate3d(angle, [cx, cy, cz], [dx, dy, dz], object) rotates a 3D object by the given angle around the rotation axis defined by the point [cx, cy, cz] and the direction [dx, dy, dz].

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.

Rotate objects can rotate several graphical objects simultaneously. Plotting the rotate object renders all graphical objects inside.

Rotated objects have a tendency to overestimate their ViewingBox. See the help page of ViewingBox. In such cases, specify a suitable ViewingBox explicitly.

Transformation objects can be used inside rotate objects. If they are animated, the animations run simultaneously.

Animated rotate objects are rather "cheap" concerning computing and storing costs. For more complex graphical objects, it is more efficient to use an animated rotate object than to redefine the object for each frame.

The function op allows to extract the graphical objects inside a rotate object.


AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
Anglerotation angle0
Axisrotation axis[0, 0, 1]
AxisXx-component of rotation axis0
AxisYy-component of rotation axis0
AxisZz-component of rotation axis1
Centercenter of objects, rotation center[0, 0, 0]
CenterXcenter of objects, rotation center, x-component0
CenterYcenter of objects, rotation center, y-component0
CenterZcenter of objects, rotation center, z-component0
Framesthe number of frames in an animation50
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


Example 1

3D boxes with arbitrary orientation can be generated via plot::Rotate3d. Use several animated rotation objects:

b0 := plot::Box(-3..3, -2..2, -1..1):
b1 :=  plot::Rotate3d(a, [0, 0, 0], [0, 0, 1], b0, 
                      a = 0..PI/2, TimeRange = 0..3):
b2 :=  plot::Rotate3d(a, [0, 0, 0], [0, 1, 0], b1, 
                      a = 0..PI/2, TimeRange = 3..6):
b3 :=  plot::Rotate3d(a, [0, 0, 0], [1, 0, 0], b2, 
                      a = 0..PI/2, TimeRange = 6..9):
plot(b0, b3):

delete b0, b1, b2, b3



The rotation angle in radians: a numerical real value or an arithmetical expression of the animation parameter a.

angle is equivalent to the attribute Angle.

cx, cy, cz

The components of the rotation center: numerical real values or arithmetical expressions of the animation parameter a. If no rotation center is specified, the center [0, 0, 0] is used.

cx, cy, cz are equivalent to the attributes Center, CenterX, CenterY, CenterZ.

dx, dy, dz

The components of the direction of the rotations axis: numerical real values or arithmetical expressions of the animation parameter a. If no direction is specified, the direction [0, 0, 1] is used.

dx, dy, dz are equivalent to the attributes Axis, AxisX, AxisY, AxisZ.

obj1, obj2, …

Arbitrary plot objects of the appropriate dimension


Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.

Was this topic helpful?