Why do three-dimensional axes get clipped on rotation when using camera "perspective" projection in MATLAB 6.5 (R13)?

2 views (last 30 days)
I face this problem at some camera positions when the 3D graph is rotated.
For example, If I run the code below and rotate the axes, then the axes are clipped:
f = figure;
set(f,'Renderer','zbuffer');
set(gca,'Projection','Perspective');
axis vis3d on;
axis equal;
grid on;
axis (gca,[-30 30 -30 30 -30 30])
X = -15;
Y = -15;
widthX = 30;
widthY = 30;
verts = 20;
Sx = linspace(0,1,verts);
Sy = linspace(0,1,verts);
Sx = Sx * widthX + X;
Sy = Sy * widthY + Y;
Sz = zeros(verts, verts);
surface(Sx,Sy,Sz);
x = 0.0;
y = 0.0;
z = 1.0;
az = -0.5;
el = 0.0;
fov = 25;
campos(gca, [x,y,z]);
[targx,targy,targz] = sph2cart(az,el,1);
camtarget(gca, [x+targx, y+targy, z+targz] );

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This problem has been fixed in MATLAB 7.0 (R14). If you are using a previous version, read the following:
We have verified that there is a bug in MATLAB 6.5 (R13) in the way that rotation is handled with the "perspective" projection of an axes.
In some camera positions, the 3D graph is clipped during camera rotation.
To work around this issue, set the axes' "Projection" property to "orthographic" instead of "perspective" while performing the rotation.

More Answers (0)

Categories

Find more on MATLAB Support Package for USB Webcams in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!