import matplotlib.pyplot as plt import math import cmath V=complex(0,1) W=complex(1,1) Q=complex(1,0) def plotc(zs): xs=[z.real for z in zs] ys=[z.imag for z in zs] plt.plot(xs,ys) def H(z): A=z B=z+V C=(A+B)/2 D=C+1 E=B+1 F=A+1 zs=[A,B,C,D,E,F] plotc(zs) def I(z): zs=[z,z+V] plotc(zs) def A(z): A=z;B=A+W;C=A+2 P=(A+B)/2;Q=(C+B)/2 zs=[A,B,Q,P,Q,C] plotc(zs) def U(z): Q=z+V/2 B=Q-1/2;A=B+V/2 C=B+1;D=A+1 al=2*math.pi/30 zs=[A,B] for i in range(15,30): R=Q+cmath.rect(1/2,al*i) zs.append(R) zs+=[C,D] plotc(zs) def T(z): A=z; B=A+V; C=B-Q; D=B+Q zs=[A,B,C,B,D] plotc(zs) def N(z): A=z; B=A+V; C=A+W-V; D=C+V zs=[A,B,C,D] plotc(zs) def S(z): X=z-1 A=z;B=A+V/2+Q;C=B-2*Q zs=[A,B,C] plotc(zs) def L(z): A=z+1;B=z;C=z+V zs=[C,B,A] plotc(zs) def B(z,n): V = complex(0,n) A = z B = z + 3*V C = A+V E = A-V zs = [A,E,B,C] r = V for i in range(16): A = 2*math.pi*i/30 zi = z + 2*V - complex( r*math.cos(A) , 4*r*math.sin(A) ) zs.append( zi ) for i in range(16): A = 2*math.pi*i/30 zi = z - complex( r*math.cos(A) , 4*r*math.sin(A) ) zs.append( zi ) plotc(zs) def s(z): v=complex(0,1) a=z d=a+1/4 b=a+v f=b+1/4 c=(a+b)/2 g=c+1/4 al=2*math.pi/360 zs=[a,d] for i in range (270, 451): e=(d+g)/2+cmath.rect(1/4,al*i) zs.append(e) zs+=[g,c] for j in range (270, 90,-1): k=(c+b)/2+cmath.rect(1/4,al*j) zs.append(k) zs+=[b,f] plotc(zs) B(-0.2+0.25*V,0.25) s(2.5) U(1.5) T(4) I(5.2) H(5.4) A(6.5) N(8.7) A(10.7) L(12.8) I(14) N(14.2) plt.ylim(-5,5) plt.show()