from turtle import * ech = 3.5 def draw_line(p1, p2): penup() goto(p1) pendown() goto(p2) def interpolate(p1, p2, t): return (-108 + ech * (p1[0] + t * (p2[0] - p1[0])), -112 + ech * (p1[1] + t * (p2[1] - p1[1]))) def bande(u1, u2, u3, u4, k): for i in range(k + 1): t = i / k p1 = interpolate(u1, u2, t) p2 = interpolate(u3, u4, t) draw_line(p1, p2) def draw_mesh(q): global p (x1, y1), (x2, y2), (x3, y3), (x4, y4) = [p[v] for v in q[0]] (m, n) = q[1] bande((x1, y1), (x2, y2), (x4, y4), (x3, y3), m) bande((x1, y1), (x4, y4), (x2, y2), (x3, y3), n) a, b = 40, 12 p = (18,50), (50,44), (44, 12), (12, 18), (-16, 0), (76, 0), (76, 64), (-16, 64) q1 = (4, 3, 0, 7), (a, b) q2 = (4, 5, 2, 3), (b, a) q3 = (5, 6, 1, 2), (b, a) q4 = (6, 1, 0, 7), (a, b) q5 = (0, 1, 2, 3), (b, b) speed(0) for q in q1,q2,q3,q4,q5: draw_mesh(q) hideturtle()