File Exchange

image thumbnail

trackball for better viewing 3D plot

version 1.1.0.0 (9.6 KB) by simbaforrest
Better 3D plot viewing than Matlab's default rotate3d

3 Downloads

Updated 05 May 2016

View License

Matlab's default rotate3d suffers from Gimbol-Lock effect. Using this trackball function, one can better enjoy 3D plot viewing.
Example:
figure;
sphere(36);
axis equal;
grid on;
trackball on;
Enjoy!

Comments and Ratings (5)

Thomas

Hi Chen. I realized afterwards that the issue related to the axis units in the GUI rather than the code itself.
Thanks
Thomas

Hi Thomas,

I tried the script you provided and maximize the figure, it appears that the rotation works fine (unless the sphere is shown with a very small scale, and in that case, just zooming in should solve the problem). Let me know if this is the case.

Best,
Chen

Thomas

Thanks for your response Chen. Actually it has nothing to do with data volume. Rotation is very smooth even with a one million cloud using pcshow() (Computer Vision Systems Toolbox) on my notebook. The issue appears to relate to the size of the figure window. Using the worked example:

>>sphere(36);
axis equal;
trackball on;
axis vis3d;
axis off;

At the default figure window display size the function works nicely. However, if you maximize the figure, the mouse movements translate to very marginal rotations of the sphere. This is very frustrating when the current axis is in a GUI (which needs to be maximized). Is there a work around for scaling the mouse movements to a maximized figure. It would be a very useful function for GUI tools if this can be fixed.
Cheers
Thomas

Hi Thomas,

Are you drawing lots of points or lines? If that is the case, it will indeed be sluggish, which I think is due to Matlab's poor rendering pipeline rather than this script. Maybe you can turn on some hardware acceleration?

Best,
Chen

Thomas

Hi
Do you know how to increase sensitivity of rotation to mouse movements? The code is an improvement over default rotate but is a little sluggish.

Updates

1.1.0.0

improved title

1.1.0.0

fixed a minor bug for add/remove the temp center dot

1.0.0.0

improve title

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Virtual Tackball