part 1
part1 動畫
x=[0 17 17*cosd(60) 0];
y=[0 0 17*sind(60) 0];
line(x,y);
for d=0:30:360
x1 = x*cosd(d)+y*sind(d);
y1 =-x*sind(d)+y*cosd(d);
x2=17+x1;x3=x1+17*cosd(60);
y3=y1+17*sind(60);
line(x1,y1,'erasemode','xor','color','k');
line(x2,y1,'erasemode','xor','color','r');
ine(x3,y3,'erasemode','xor','color','y');
axis equal;
pause(0.5);
end;
part2
part2動畫
x=[0 10 10 0 0];
y=[2 2 -2 -2 2];
[a b]=scircle1(10,0,2,[-90 90]);
[a1 b1]=scircle1(0,0,2,[90 270]);
for i=0:30:360
x1=x*cosd(-i)+y*sind(-i);
y1=-x*sind(-i)+y*cosd(-i);
at=a*cosd(-i)+b*sind(-i);
bt=-a*sind(-i)+b*cosd(-i);
a1t=a1*cosd(-i)+b1*sind(-i);
b1t=-a1*sind(-i)+b1*cosd(-i);
Xs=[10*cosd(i) 15];
Ys=[10*sind(i) 0];
[p1 p2]=scircle1(10*cosd(i) ,10*sind(i),1 );
[p3 p4]=scircle1(0,0,1);line(x1,y1,'color','red');
line(at,bt,'color','red');line(a1t,b1t,'color','red');
line(p1,p2,'color','red' )
line(p3,p4,'color','red');
line(Xs,Ys);pause(0.5);
axis equal;
end;
part3
part3動畫
引用講義的旋轉function
import function:
function linkshape(A,B,dd)
if nargin==2,dd=1;
end;d=abs(dd);
AB=(B(1)+j*B(2))-(A(1)+j*A(2));
D=abs(AB);th=angle(AB);
t=linspace(pi/2,2.5*pi,20);
Cout=max(d/2,0.2)*exp(j*t');
Cin=Cout/2;if dd>0, P=[0;Cin;Cout(1:10);
D+Cout(11:20);D+Cin;D+Cout(20);Cout(1)];
else
P=[Cin;0;D;D+Cin];endxx=real(P);
yy=imag(P);x=xx*cos(th)-yy*sin(th)+A(1);
y=xx*sin(th)+yy*cos(th)+A(2);
line(x,y)
axis equal
----------------------------------------------------
x=[0 17 17*cosd(60) 0];
y=[0 0 17*sind(60) 0];
line(x,y);
for d=0:30:360
x1 = x*cosd(d)+y*sind(d);
y1 =-x*sind(d)+y*cosd(d);
x2=17+x1;x3=x1+17*cosd(60);
y3=y1+17*sind(60);
line(x1,y1,'erasemode','xor','color','k');
line(x2,y1,'erasemode','xor','color','r');
ine(x3,y3,'erasemode','xor','color','y');
axis equal;
pause(0.5);
end;
part2
part2動畫
x=[0 10 10 0 0];
y=[2 2 -2 -2 2];
[a b]=scircle1(10,0,2,[-90 90]);
[a1 b1]=scircle1(0,0,2,[90 270]);
for i=0:30:360
x1=x*cosd(-i)+y*sind(-i);
y1=-x*sind(-i)+y*cosd(-i);
at=a*cosd(-i)+b*sind(-i);
bt=-a*sind(-i)+b*cosd(-i);
a1t=a1*cosd(-i)+b1*sind(-i);
b1t=-a1*sind(-i)+b1*cosd(-i);
Xs=[10*cosd(i) 15];
Ys=[10*sind(i) 0];
[p1 p2]=scircle1(10*cosd(i) ,10*sind(i),1 );
[p3 p4]=scircle1(0,0,1);line(x1,y1,'color','red');
line(at,bt,'color','red');line(a1t,b1t,'color','red');
line(p1,p2,'color','red' )
line(p3,p4,'color','red');
line(Xs,Ys);pause(0.5);
axis equal;
end;
part3
part3動畫
引用講義的旋轉function
import function:
function linkshape(A,B,dd)
if nargin==2,dd=1;
end;d=abs(dd);
AB=(B(1)+j*B(2))-(A(1)+j*A(2));
D=abs(AB);th=angle(AB);
t=linspace(pi/2,2.5*pi,20);
Cout=max(d/2,0.2)*exp(j*t');
Cin=Cout/2;if dd>0, P=[0;Cin;Cout(1:10);
D+Cout(11:20);D+Cin;D+Cout(20);Cout(1)];
else
P=[Cin;0;D;D+Cin];endxx=real(P);
yy=imag(P);x=xx*cos(th)-yy*sin(th)+A(1);
y=xx*sin(th)+yy*cos(th)+A(2);
line(x,y)
axis equal
----------------------------------------------------
for i=0:30:360
linkshape([10 0 ],[0 0],2);
linkshape ([0 0],[5*cosd(i) 5*sind(i)],3 );
linkshape([5*cosd(i) 5*sind(i)],[5*cosd(i)+10 5*sind(i) ],1.5);
linkshape([10 0],[5*cosd(i)+10 5*sind(i)],2);
pause(0.5);
end;