| MATLAB Function Reference | ![]() |
Rotate object about a specified direction
Syntax
Description
The rotate function rotates a graphics object in three-dimensional space, according to the right-hand rule.
rotate(h,direction,alpha)
rotates the graphics object h by alpha degrees. direction is a two- or three-element vector that describes the axis of rotation in conjunction with the origin.
rotate(...,origin)
specifies the origin of the axis of rotation as a three-element vector. The default origin is the center of the plot box.
Remarks
The graphics object you want rotated must be a child of the same axes. The object's data is modified by the rotation transformation. This is in contrast to view and rotate3d, which only modify the viewpoint.
The axis of rotation is defined by an origin and a point P relative to the origin. P is expressed as the spherical coordinates [theta phi] or as Cartesian coordinates.
The two-element form for direction specifies the axis direction using the spherical coordinates [theta phi]. theta is the angle in the x-y plane counterclockwise from the positive x-axis. phi is the elevation of the direction vector from the x-y plane.
The three-element form for direction specifies the axis direction using Cartesian coordinates. The direction vector is the vector from the origin to (X,Y,Z).
Examples
Rotate a graphics object 180º about the x-axis.
Rotate a surface graphics object 45º about its center in the z direction.
Remarks
rotate changes the Xdata, Ydata, and Zdata properties of the appropriate graphics object.
See Also
The axes CameraPosition, CameraTarget, CameraUpVector, CameraViewAngle
Object Manipulation for related functions
| rot90 | rotate3d | ![]() |
© 1994-2005 The MathWorks, Inc.