Python精灵模块的axis_points指令

所有命令 单独命令 屏幕命令 角色命令

单独命令 >> Python精灵模块的axis_points轴对称指令

简介:建设中...
例子:
import random
import turtle
from sprites import Screen,axis_points    

screen = Screen()
screen.xy_grid()

# 两个定点,作为对称轴
d1 = (-100,-100)
d2 = (200,200)
line = d1,d2           # 定义轴
turtle.goto(d1);turtle.pd();turtle.goto(d2);turtle.penup()
cors = [(50,-100),(80,50),(150,20)]
cors2 = axis_points(cors,line) # 返回cors中的点关于line对称的点
for p1,p2 in zip(cors,cors2):
    turtle.goto(p1);turtle.dot(10,'red');turtle.pd()
    turtle.goto(p2);turtle.dot(10,'blue');turtle.pu()   

turtle.ht()
turtle.done()

writed by lixingqiu 关注"异编程"微信公众号,获取更多关于Python精灵模块的咨讯: