Dear All,
I have a plot3 object (3D surface) in a figure that I can (and often have to) freely rotate3d, pan, zoom. I need to add text to the figure that would be still with respect to rotate3d, pan, zoom (would look like caption on TV). Here is the relevant code portion:
figure;plot3(surface..)... panHandle = pan(gcf); rotateHandle = rotate3d(gcf); zoomHandle = zoom(gcf); set(rotateHandle,'ActionPreCallback',@rotationStarted); set(rotateHandle,'ActionPostCallback',@rotationDone); rotateHandle.Enable='on'; set(zoomHandle,'ActionPreCallback',@zoomStarted) set(zoomHandle,'ActionPostCallback',@zoomEnded) zoomHandle.Enable='on'; set(panHandle,'ActionPreCallback',@panStarted) set(panHandle,'ActionPostCallback',@panEnded) panHandle.Enable='on';function rotationStarted(~,rotateHandle) for i=1:length(Handle) set(Handle{i},'visible','off'); endendfunction rotationDone(~,rotateHandle) for i=1:length(Handle) set(Handle{i},'visible','on'); endendfunction zoomStarted(~,zoomHandle) for i=1:length(Handle) set(Handle{i},'visible','off'); endendfunction zoomEnded(~,zoomHandle) for i=1:length(Handle) set(Handle{i},'visible','on'); endendfunction panStarted(~,panHandle) for i=1:length(Handle) set(Handle{i},'visible','off'); endendfunction panEnded(~, panHandle) for i=1:length(Handle) set(Handle{i},'visible','on'); endend
I thought that the natural way is to add a second set of 3D axes identical to the plot3 object ones, however which would not be subject to rotate3d, pan, zoom (ie. restrict the rotation handles to axes1 instead of gcf), and add text to this second axis set.
Please advise, thank you,
Octavian.
Best Answer