How can I use the ROTATE3D Tool along with setting the Camera Up Vector in MATLAB 7.9 (R2009b)?

18 views (last 30 days)
When using the Rotate 3D tool, MATLAB will reset the camera position and the camera up vector that I had previously set.
Is there any way to use these tools together?
For example, try the following in MATLAB:
%%
clf
sphere
%% Set the up vector
camup([0 1 0])
%%
rotate3d on
% Now Rotating the axis will cause the Camera Up vector to be reset.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Dec 2021
Edited: MathWorks Support Team on 13 Dec 2021
This behavior is expected. The Camera tools and the Rotate tools are two separate active window tools that reset each other. To view an axes for which the camera properties have been set from a different angle, use the Camera Toolbar instead of the Rotate 3D tool.
For example, try the following:
sphere
%% Set the up vector
camup([0 1 0])
% Instead of ROTATE3D stick with the camera tools itself to change view.
cameratoolbar('Show')
Next, click on the first togglebutton on the camera toolbar. This turns on the Camera Orbit tool. Now set the Coordinate system axis to be 'None' by using the last toggle button for the Principal axis selector in the toolbar (the default is Principal Z). Now if you use the Camera Orbit rather than the Rotate 3D tool, the view of the axis does not reset when you start to rotate the axis.
The CAMORBIT command rotates the camera position around the camera target. The 'coordsys' function parameter allows the user to specify whether the rotation occurs around the point defined by the camera target, or around the axes defined by this point and the direction indicated. Note that the location of the camera target does not change relative to the camera when CAMORBIT is used, but it may change if ROTATE3D is used.
As the following documentation page describes:
"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."
For more information about the ROTATE3D and CAMORBIT commands, refer to the documentation for each of these tools:
Rotate camera position around camera target - MATLAB
Rotate 3-D view using mouse - MATLAB
View Control with the Camera Toolbar :: Defining the View (MATLAB®)
Rotate camera position around camera target - MATLAB

More Answers (0)

Tags

Products


Release

R2009b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!