clc;
x=[-50 -50 50 50 -50];
y=[-50 50 50 -50 -50];
plot(x,y,'black');
axis([-60 60 -60 60]);
hold on;
x=[-25 -25 25 25 -25];
y=[-12.5 12.5 12.5 -12.5 -12.5];
p = patch('XData',x,'YData',y,'FaceColor','white');
pt2 = [1 1 1];
time_instants = 250;
for i=1:1:1000
right_max = 50 - max(x);
left_max = -50 - min(x);
for t=linspace(right_max, left_max, time_instants)
p.Vertices(:,1) = x' + t;
drawnow
end
pt2=pt2+[-0.125 0.125 0];
x = x*pt2(1);
y = y*pt2(2);
p.Vertices(:,2) = y;
right_max = 50 - max(x);
left_max = -50 - min(x);
for t=linspace(left_max, right_max, time_instants)
p.Vertices(:,1) = x' + t;
drawnow
end
pt2=pt2+[-0.125 0.125 0];
x = x*pt2(1);
y = y*pt2(2);
p.Vertices(:,2) = y;
end
Best Answer
Hello Jacob Cialou-Clark:
as you specify a 3D faced object you have to take care which vertices you connect to faces. Right now, you define the mantle which cannot be seen directly from 2D plot via patch(). Another problem is that 'FaceAlpha',0 represents completely transparent faces.
In order to change that and have all faces of your 3D wing in 'red' you can change your code to:
Kind regards,
Robert