Skip to Main Content Skip to Search
Product Documentation

camorbit - Rotate camera position around camera target

Syntax

camorbit(dtheta,dphi)
camorbit(dtheta,dphi,'coordsys')
camorbit(dtheta,dphi,'coordsys','direction')
camorbit(axes_handle,...)

Description

camorbit(dtheta,dphi) rotates the camera position around the camera target by the amounts specified in dtheta and dphi (both in degrees). dtheta is the horizontal rotation and dphi is the vertical rotation.

camorbit(dtheta,dphi,'coordsys') rotates the camera position around the camera target, using the coordsys argument to determine the center of rotation. coordsys can take on two values:

camorbit(dtheta,dphi,'coordsys','direction') defines the axis of rotation for the data coordinate system using the direction argument in conjunction with the camera target. Specify direction as a three-element vector containing the x-, y-, and z-components of the direction or one of the characters, x, y, or z, to indicate [1 0 0], [0 1 0], or [0 0 1] respectively.

camorbit(axes_handle,...) operates on the axes identified by the first argument, axes_handle. When you do not specify an axes handle, camorbit operates on the current axes.

The behavior of camorbit differs from the rotate3d function in that while the rotate3d tool modifies the View property of the axes, the camorbit function fixes the aspect ratio and modifies the CameraTarget, CameraPosition and CameraUpVector properties of the axes. See Axes Properties for more information.

Examples

Rotate the camera horizontally about a line defined by the camera target point and a direction that is parallel to the y-axis. Visualize this rotation as a cone formed with the camera target at the apex and the camera position forming the base:

surf(peaks)
axis vis3d
for i=1:36
   camorbit(10,0,'data',[0 1 0])
   drawnow
end
 

Rotate in the camera coordinate system to orbit the camera around the axes along a circle while keeping the center of a circle at the camera target:

surf(peaks)
axis vis3d
for i=1:36
   camorbit(10,0,'camera')
   drawnow
end

Alternatives

Enable 3-D rotation from the figure Tools menu or the figure toolbar.

See Also

axes | axis | camdolly | campan | camroll | camzoom

How To

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS