0
軸を中心にオブジェクトを回転させることはできますが、シータは非常にオフです 1度から45度まで1度ずつ回転させる必要がありますが、私はtheta(th)を度からラジアンに変換しましたが、それでも問題は発生します。3dオブジェクトの回転増分がオフです
は、ここで回転 https://www.dropbox.com/s/bnc7m4fxipicizr/rot2.gif
のアニメーションへのリンクだとコードは以下の通りです:私はMathWorks社のMATLABのようなものですオクターブ4.0を使用してい
clf
[Z,Y,X] = cylinder(10:-1:0, 50);
xlabel('X axis')
ylabel('Y axis')
zlabel('Z axis')
array_sz_begin=size(X);
W=repmat(1,array_sz_begin); %create ones for w
figure(1), clf;surf(X,Y,Z);axis equal;
%--- z-rotation matrix Rz
for n=1:1:45
th=n*pi/180; %angle of rotation converted to radians;
Rz=[cos(th) -sin(th) 0 0;sin(th) cos(th) 0 0;0 0 1 0;0 0 0 1];
P=[X(:) Y(:) Z(:) W(:)]*Rz; %rotate each point on surface
X=reshape(P(:,1),array_sz_begin);%transform surface vertices back
Y=reshape(P(:,2),array_sz_begin);
Z=reshape(P(:,3),array_sz_begin);
xlabel('X axis')
ylabel('Y axis')
zlabel('Z axis')
clear P;
title(['Shift in ',num2str(n),' deg']);
hold on;surf(X,Y,Z);axis equal;
pause (.5)
end
PS。
に行きます。ループ内の 'theta 'の値を変更せずにコードを実行してみてください – BillBokeey
' th'(theta)を変更しないと@BillBokeeyどのように回転しますか? –
あなたは1回の回転ごとに1度の回転を得ます。これはあなたが望むものです(forループの前に 'th = pi/180'を定義する必要があります)。 (ただ試してみてください) – BillBokeey