MATLAB Function Reference
  Go to function:
    Search    Help Desk 
rotate    Examples   See Also

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 is 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 xy plane counterclockwise from the positive x-axis. phi is the elevation of the direction vector from the xy 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

rotate3d, sph2cart, view

The Axes CameraPosition, CameraTarget, CameraUpVector, CameraViewAngle



[ Previous | Help Desk | Next ]