簡體   English   中英

旋轉三維Matlab圖時保持對象大小不變

[英]Keep object size constant when rotating 3-D Matlab plot

我試圖在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

我怎樣才能使球體看起來大小相同,無論它在什么角度觀察?

axis功能是你的朋友。 嘗試添加

axis vis3d

從幫助中,“軸VIS3D凍結縱橫比屬性以啟用3-D對象的旋轉並覆蓋拉伸到填充。” 如果你有興趣同樣這可以通過

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM