Saturday, July 25, 2009

Continued..

campos

Set or query the camera position

Syntax

  • campos
    campos([camera_position])
    campos('mode')
    campos('auto'
    campos('manual')
    campos(axes_handle,...)

Description

campos with no arguments returns the camera position in the current axes.

campos([camera_position]) sets the position of the camera in the current axes to the specified value. Specify the position as a three-element vector containing the x-, y-, and z-coordinates of the desired location in the data units of the axes.

campos('mode') returns the value of the camera position mode, which can be either auto (the default) or manual.

campos('auto') sets the camera position mode to auto.

campos('manual') sets the camera position mode to manual.

campos(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, campos operates on the current axes.

Remarks

campos sets or queries values of the axes CameraPosition and CameraPositionMode properties. The camera position is the point in the Cartesian coordinate system of the axes from which you view the scene.

Examples

This example moves the camera along the x-axis in a series of steps:

  • surf(peaks)
    axis vis3d off
    for x = -200:5:200
    campos([x,5,10])
    drawnow
    end

camproj

Set or query the projection type

Syntax

  • camproj
    camproj(projection_type)
    camproj(axes_handle,...)

Description

The projection type determines whether MATLAB uses a perspective or orthographic projection for 3-D views.

camproj with no arguments returns the projection type setting in the current axes.

camproj('projection_type') sets the projection type in the current axes to the specified value. Possible values for projection_type are: orthographic and perspective.

camproj(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, camproj operates on the current axes.



camproj

Set or query the projection type

Syntax

  • camproj
    camproj(projection_type)
    camproj(axes_handle,...)

Description

The projection type determines whether MATLAB uses a perspective or orthographic projection for 3-D views.

camproj with no arguments returns the projection type setting in the current axes.

camproj('projection_type') sets the projection type in the current axes to the specified value. Possible values for projection_type are: orthographic and perspective.

camproj(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, camproj operates on the current axes.



camtarget

Set or query the location of the camera target

Syntax

  • camtarget
    camtarget([camera_target])
    camtarget('mode')
    camtarget('auto')
    camtarget('manual')
    camtarget(axes_handle,...)

Description

The camera target is the location in the axes that the camera points to. The camera remains oriented toward this point regardless of its position.

camtarget with no arguments returns the location of the camera target in the current axes.

camtarget([camera_target]) sets the camera target in the current axes to the specified value. Specify the target as a three-element vector containing the x-, y-, and z-coordinates of the desired location in the data units of the axes.

camtarget('mode') returns the value of the camera target mode, which can be either auto (the default) or manual.

camtarget('auto') sets the camera target mode to auto.

camtarget('manual') sets the camera target mode to manual.

camtarget(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, camtarget operates on the current axes.

Remarks

camtarget sets or queries values of the axes object Cameratarget and CameraTargetMode properties.

When the camera target mode is auto, MATLAB positions the camera target at the center of the axes plot box.

Examples

This example moves the camera position and the camera target along the x-axis in a series of steps:

  • surf(peaks);
    axis vis3d
    xp = linspace(-150,40,50);
    xt = linspace(25,50,50);
    for i=1:50
    campos([xp(i),25,5]);
    camtarget([xt(i),30,0])
    drawnow
    end
camup

Set or query the camera up vector

Syntax

  • camup
    camup([up_vector])
    camup('mode')
    camup('auto')
    camup('manual')
    camup(axes_handle,...)

Description

The camera up vector specifies the direction that is oriented up in the scene.

camup with no arguments returns the camera up vector setting in the current axes.

camup([up_vector]) sets the up vector in the current axes to the specified value. Specify the up vector as x-, y-, and z-components. See Remarks.

camup('mode') returns the current value of the camera up vector mode, which can be either auto (the default) or manual.

camup('auto') sets the camera up vector mode to auto. In auto mode, MATLAB uses a value for the up vector of [0 1 0] for 2-D views. This means the z-axis points up.

camup('manual') sets the camera up vector mode to manual. In manual mode, MATLAB does not change the value of the camera up vector.

camup(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, camup operates on the current axes.

Remarks

camup sets or queries values of the axes object CameraUpVector and CameraUpVectorMode properties.

Specify the camera up vector as the x-, y-, and z-coordinates of a point in the axes coordinate system that forms the directed line segment PQ, where P is the point (0,0,0) and Q is the specified x-, y-, and z-coordinates. This line always points up. The length of the line PQ has no effect on the orientation of the scene. This means a value of [0 0 1] produces the same results as [0 0 25].



camva

Set or query the camera view angle

Syntax

  • camva
    camva(view_angle)
    camva('mode')
    camva('auto')
    camva('manual')
    camva(axes_handle,...)

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.

camva with no arguments returns the camera view angle setting in the current axes.

camva(view_angle) sets the view angle in the current axes to the specified value. Specify the view angle in degrees.

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,

  • camva(camva)

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:

  • surf(peaks);

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.



camzoom

Zoom in and out on a scene

Syntax

  • camzoom(zoom_factor)
    camzoom(axes_handle,...)

Description

camzoom(zoom_factor) zooms in or out on the scene depending on the value specified by zoom_factor. If zoom_factor is greater than 1, the scene appears larger; if zoom_factor is greater than zero and less than 1, the scene appears smaller.

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

Remarks

camzoom sets the axes CameraViewAngle property, which in turn causes the CameraViewAngleMode property to be set to manual. Note that setting the CameraViewAngle property disables the MATLAB stretch-to-fill feature (stretching of the axes to fit the window). This may result in a change to the aspect ratio of your graph. See the axes function for more information on this behavior.

No comments:

Post a Comment