首页 文章

旋转三维Matlab图时保持对象大小不变

提问于
浏览
4

我试图在Matlab中生成一组三维对象的视图,使角度发生变化但对象大小保持不变 . 由于Matlab尝试将整个轴拟合到视图中,因此对象将缩小或增大,具体取决于是以正面还是以某个角度查看绘图 . 举个例子:

[x,y,z] = sphere(50); % coordinates of a sphere
surf(x,y,z);          % plot the sphere
axis image off
view(0,0)             % at this angle the sphere fills the axes
view(-37.5,30)        % at this angle the sphere is much smaller

我怎样才能使球体看起来大小相同,无论它在什么角度观察?

1 回答

  • 4

    axis功能是你的朋友 . 尝试添加

    axis vis3d
    

    从帮助中,“轴VIS3D冻结纵横比属性以启用3-D对象的旋转并覆盖拉伸到填充 . ”如果你有兴趣同样这可以通过

    ax = gca;
    props = {'CameraViewAngle','DataAspectRatio','PlotBoxAspectRatio'};
    set(ax,props,get(ax,props));
    

相关问题