File Exchange

image thumbnail

Figure Rotator

version 1.1.0.1 (7.23 KB) by Tucker McClure
Allows a user to easily navigate around a target point in a 3D figure using a mouse.

3 Downloads

Updated 01 Sep 2016

View License

The FigureRotator is a light and fast tool allowing a user to easily navigate around a target point in a 3D figure using a mouse. The camera will "orbit" a target point, move in and out, and zoom.
While these types of motion are available in MATLAB's built-in Camera Toolbar, the FigureRotator provides a combined interface allowing rotation, movement, and zooming to happen all at once by using the left mouse button for rotation, the scroll wheel for movement in and out, and the right mouse button for zooming, allowing a user to explore a 3D object more quickly. Further, the FigureRotator appears to work more quickly than the Camera Toolbar tools if the figure is also being animated.
Example:

peaks;
f = FigureRotator(gca());

Try 'help FigureRotator' for more examples or see example_figure_rotator.m for an example involving smooth motion during animation.

Comments and Ratings (9)

Great tool !

Great tool!...is there a way to get this to zoom in on the current mouse position in the figure?

Would anybody know how to incorporate a camlight update within this? Something like

camlight(camlight_handle,'right')

everytime you clicked the mouse.

Ingenious. Why isn't this original MATLAB functionality?

John

Hi Mohamed,

Thanks for the feedback! Oliver's tool (the URL is in his comment below) includes panning. Panning could also be added directly to the FigureRotator, but I chose not to do this for a good reason. The FigureRotator is an "orbit a point" type motion instead of a "stand in a point and look around" type of motion. As such, if one was to pan around a bit, the point that one is "orbiting" becomes unclear, and getting it where one wants it might be difficult.

When I've created tools like this in the past for specific projects, I usually added "hotkeys" or something to change the orbit point (CameraTarget) from one object (say, a location on the ground) to another object (say, a satellite).

If you'd definitely like to add panning to this and aren't concerned about "losing" the orbit point, then just message me, and I can provide some tips!

Thanks again.

Hi Tucker,
Do you have an idea how panning (using the mouse) can be added?

I tried to work with 'Cameratarget','Cameraposition' and 'Cameraupvector'.... but no way.

I like that it uses the scroll wheel.
Here's yet another:
http://www.mathworks.co.uk/matlabcentral/fileexchange/38019-figure-control-widget

Updates

1.1.0.1

Updated license

1.1.0.0

Updated for new R2014b graphics system.

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

Inspired: VoxelPlotter, Figure control widget