python pygame 直线画圆

def count(angle):
# y = y2-y1
y = math.sin(math.pi * (angle / 180)) * 50
y2 = int(y + y1)
# x = x2-x1
x = math.cos(math.pi * (angle / 180)) * 50
x2 = int(x + x1)

print(math.pi)
print('x,y:', x, y)
print('x2,y2:', x2, y2)
return x2,y2

x2,y2 = count(angle)
pygame.draw.line(screen, (1, 1, 1), (x1,y1),(x2,y2), 2)


 

 180 = π , 360 = 2π

45° = π/4 

我们求弧度时也就是可以用

在180内的与180的比值 

在360内的与360的比值

posted @ 2022-04-30 09:26  记录——去繁就简  阅读(138)  评论(0)    收藏  举报