非递归法混沌法画谢尔宾斯基正五边形图

"""
   混沌法画谢尔宾斯基正五边分形图。本程序也支持画谢尔宾斯基n边形。
   这是一种分形图形,但下面的方法不是用递归法画的。
"""
import turtle
import random
import math

screen = turtle.Screen()
screen.title('非递归法混沌法画谢尔宾斯基正五边形by lixingqiu')
screen.setup(800,800)
screen.setworldcoordinates(-200,-200,200,200)
screen.tracer(0,0)

边数 = 5
points = []                # 正多边形顶点表
turtle.ht()                # 隐藏海龟对象
turtle.penup()
# 收集正多边形的几个点的坐标
turtle.goto(-200,-250)
for  i in range(边数):
    p = turtle.position()
    points.append(p)
    turtle.fd(350)
    turtle.left(360/边数)

amounts = 100000   
p = points[0]               # 从第一个点开始
t = turtle

You must log in to read the rest of this article. Please log in or register as a user.