MATLAB Function Reference |
Set or query the camera view angle
Syntax
Description
The camera view angle determines the field of view of the camera. Larger angles produce a smaller view of the scene. You can implement zooming by changing the camera view angle.
with no arguments returns the camera view angle setting in the current axes. camva
sets the view angle in the current axes to the specified value. Specify the view angle in degrees.camva(view_angle)
camva('mode')
returns the current value of the camera view angle mode, which can be either auto
(the default) or manual
. See Remarks.
camva('auto')
sets the camera view angle mode to auto
.
camva('manual')
sets the camera view angle mode to manual
. See Remarks.
camva(axes_handle,...)
performs the set or query on the axes identified by the first argument, axes_handle
. When you do not specify an axes handle, camva
operates on the current axes.
Remarks
camva
sets or queries values of the axes object CameraViewAngle
and CameraViewAngleMode
properties.
When the camera view angle mode is auto
, MATLAB adjusts the camera view angle so that the scene fills the available space in the window. If you move the camera to a different position, MATLAB changes the camera view angle to maintain a view of the scene that fills the available area in the window.
Setting a camera view angle or setting the camera view angle to manual
disables the MATLAB stretch-to-fill feature (stretching of the axes to fit the window). This means setting the camera view angle to its current value,
can cause a change in the way the graph looks. See the Remarks section of the axes
reference page for more information.
Examples
This example creates two pushbuttons, one that zooms in and another that zooms out.
uicontrol('Style','pushbutton',... 'String','Zoom In',... 'Position',[20 20 60 20],... 'Callback','if camva <= 1;return;else;camva(camva-1);end'); uicontrol('Style','pushbutton',... 'String','Zoom Out',... 'Position',[100 20 60 20],... 'Callback','if camva >= 179;return;else;camva(camva+1);end');
Now create a graph to zoom in and out on:
Note the range checking in the callback statements. This keeps the values for the camera view angle in the range greater than zero and less than 180.
See Also
axis
, camproj
, campos
, camup
, camtarget
The axes properties CameraPosition
, CameraTarget
, CameraUpVector
, CameraViewAngle
, Projection
Controlling the Camera Viewpoint for related functions
Defining Scenes with Camera Graphics for more information
camup | camzoom |
© 1994-2005 The MathWorks, Inc.