MATLAB Function Reference Previous page   Next Page
view

Viewpoint specification

Syntax

Description

The position of the viewer (the viewpoint) determines the orientation of the axes. You specify the viewpoint in terms of azimuth and elevation, or by a point in three-dimensional space.

view(az,el) and view([az,el]) set the viewing angle for a three-dimensional plot. The azimuth, az, is the horizontal rotation about the z-axis as measured in degrees from the negative y-axis. Positive values indicate counterclockwise rotation of the viewpoint. el is the vertical elevation of the viewpoint in degrees. Positive values of elevation correspond to moving above the object; negative values correspond to moving below the object.

view([x,y,z]) sets the viewpoint to the Cartesian coordinates x, y, and z. The magnitude of (x,y,z) is ignored.

view(2) sets the default two-dimensional view, az = 0, el = 90.

view(3) sets the default three-dimensional view, az = -37.5, el = 30.

view(T) sets the view according to the transformation matrix T, which is a 4-by-4 matrix such as a perspective transformation generated by viewmtx.

[az,el] = view returns the current azimuth and elevation.

T = view returns the current 4-by-4 transformation matrix.

Remarks

Azimuth is a polar angle in the x-y plane, with positive angles indicating counterclockwise rotation of the viewpoint. Elevation is the angle above (positive angle) or below (negative angle) the x-y plane.

This diagram illustrates the coordinate system. The arrows indicate positive directions.

Examples

View the object from directly overhead.

Set the view along the y-axis, with the x-axis extending horizontally and the z-axis extending vertically in the figure.

Rotate the view about the z-axis by 180º.

See Also

viewmtx, hgtransform, rotate3d

Controlling the Camera Viewpoint for related functions

Axes graphics object properties CameraPosition, CameraTarget, CameraViewAngle, Projection

Defining the View for more information on viewing concepts and techniques

Transforming Objects for information on moving and scaling objects in groups.


Previous page  vertcat viewmtx Next page

© 1994-2005 The MathWorks, Inc.