Why does the view zoom in and out randomly when I try to rotate around my 3-D image?
I have created a 3-D image and want to rotate my view around the image. As it rotates, the perspective seems to zoom in and out causing an undesired bouncing effect. The following code illustrates this effect:
% This part of the code draws an arbitrary image
figure('renderer','zbuffer','color','k') [x,y,z]=sphere; hold on for j=[-1 1], patch([-1 -1 1 1],[-1 1 1 -1],[j j j j],'b') patch([-1 -1 1 1],[j j j j],[-1 1 1 -1],'r') patch([j j j j],[-1 -1 1 1],[-1 1 1 -1],'g') surf(x+3*j,y,z) surf(x,y+3*j,z) end axis([-5 5 -6 6 -5 5],'off') view(3)%%%%%%%%%%%%%%%%
% Get the current view angle
[az,el]=view; el=el+15;%%%%%%%%%%
% Now rotate around the image
for j=10:10:360, view(az+j,el) pause(0.1) end
How can I stabalize the view so that I can rotate the camera smoothly around my image?
Best Answer