Python精灵模块的angle_bisector角平分线指令

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

单独命令 >> Python精灵模块的angle_bisector角平分线指令

简介:用于辅助画角平分线的命令。在sprites模块中,用二元组表示一个点的坐标。这命令会返回一个二元组。
例子:
from sprites import Screen,Sprite,angle_bisector,mouse_position    

def draw_triangle(self,A,B,C):
    self.penup();self.goto(A);self.pd()
    self.goto(B);self.goto(C);self.goto(A)
    self.penup()
    
screen = Screen()
screen.tracer(0,0)
screen.xy_grid()         # 显示坐标格子图

bug = Sprite()

A = (100,200)              # 一个定点
B = (50,50)                # 一个定点
C = (240,0)                # 一个定点
draw_triangle(bug,A,B,C)

D = angle_bisector(A,B,C)  # 返回角ABC的角平分线和AC的交点
bug.draw_line(B,D)

screen.mainloop()

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