import numpy as np import matplotlib.pyplot as plt def initDraw(Xmin, Xmax, Ymin, Ymax): #plt.axis('equal') plt.axis([Xmin, Xmax, Ymin, Ymax]) plt.grid() def Draw(*o): for M in o: soa = np.array(M) x,y= zip(*soa) #estrae dati da soa #print x,y plt.plot(x,y) plt.draw() def Show(): plt.show() pass def MatrixTrasl(M,T): row= len(M) col= 2 #X e Y for i in range(row): for j in range (col): M[i][j] = M[i][j]+T[j] return M L=20 initDraw(-L*0,L,-L*0,L) P=[[3,2],[5,2],[5,4],[6,4],[4,6],[2,4],[3,4],[3,2]] Draw(P) B=MatrixTrasl(P,[5,4]) Draw(B) Show()