save (e.g. gif) a rotation of a 3D geometry around to an axis
I would like to rotate the 3D geometry of a cube around two known nodes.
How can I modify the code?
% ======== CUBE
xc=1; yc=1; zc=1; % coordinated of the center
L=10; % cube size (length of an edge)
alpha=0.8; % transparency (max=1=opaque)
X = [0 0 0 0 0 1; 1 0 1 1 1 1; 1 0 1 1 1 1; 0 0 0 0 0 1];
Y = [0 0 0 0 1 0; 0 1 0 0 1 1; 0 1 1 1 1 1; 0 0 1 1 1 0];
Z = [0 0 1 0 0 0; 0 0 1 0 0 0; 1 1 1 0 1 1; 1 1 1 0 1 1];
C=’blue’; % unicolor
X = L*(X-0.5) + xc;
Y = L*(Y-0.5) + yc;
Z = L*(Z-0.5) + zc;
fill3(X,Y,Z,C,’FaceAlpha’,alpha); % draw cube
axis equal
% ======== NODES x ROTATION
axes_2_nodes = [-4,-4,6; -4,-4,-4];
% ======== ROTATION
set(gcf, ‘Color’, [1 1 1])
set(gca, ‘Visible’, ‘off’);
for i=1:5:300
view(i,33)
pause(0.15)
endI would like to rotate the 3D geometry of a cube around two known nodes.
How can I modify the code?
% ======== CUBE
xc=1; yc=1; zc=1; % coordinated of the center
L=10; % cube size (length of an edge)
alpha=0.8; % transparency (max=1=opaque)
X = [0 0 0 0 0 1; 1 0 1 1 1 1; 1 0 1 1 1 1; 0 0 0 0 0 1];
Y = [0 0 0 0 1 0; 0 1 0 0 1 1; 0 1 1 1 1 1; 0 0 1 1 1 0];
Z = [0 0 1 0 0 0; 0 0 1 0 0 0; 1 1 1 0 1 1; 1 1 1 0 1 1];
C=’blue’; % unicolor
X = L*(X-0.5) + xc;
Y = L*(Y-0.5) + yc;
Z = L*(Z-0.5) + zc;
fill3(X,Y,Z,C,’FaceAlpha’,alpha); % draw cube
axis equal
% ======== NODES x ROTATION
axes_2_nodes = [-4,-4,6; -4,-4,-4];
% ======== ROTATION
set(gcf, ‘Color’, [1 1 1])
set(gca, ‘Visible’, ‘off’);
for i=1:5:300
view(i,33)
pause(0.15)
end I would like to rotate the 3D geometry of a cube around two known nodes.
How can I modify the code?
% ======== CUBE
xc=1; yc=1; zc=1; % coordinated of the center
L=10; % cube size (length of an edge)
alpha=0.8; % transparency (max=1=opaque)
X = [0 0 0 0 0 1; 1 0 1 1 1 1; 1 0 1 1 1 1; 0 0 0 0 0 1];
Y = [0 0 0 0 1 0; 0 1 0 0 1 1; 0 1 1 1 1 1; 0 0 1 1 1 0];
Z = [0 0 1 0 0 0; 0 0 1 0 0 0; 1 1 1 0 1 1; 1 1 1 0 1 1];
C=’blue’; % unicolor
X = L*(X-0.5) + xc;
Y = L*(Y-0.5) + yc;
Z = L*(Z-0.5) + zc;
fill3(X,Y,Z,C,’FaceAlpha’,alpha); % draw cube
axis equal
% ======== NODES x ROTATION
axes_2_nodes = [-4,-4,6; -4,-4,-4];
% ======== ROTATION
set(gcf, ‘Color’, [1 1 1])
set(gca, ‘Visible’, ‘off’);
for i=1:5:300
view(i,33)
pause(0.15)
end rotation, 3d, 3d plots MATLAB Answers — New Questions