31 lines
No EOL
784 B
Python
31 lines
No EOL
784 B
Python
#!/usr/bin/python3
|
|
from math import sin,cos
|
|
import pygame
|
|
def berechne_dreieck(alpha,c):
|
|
a = cos(alpha)*c# x
|
|
b = sin(alpha)*c# y
|
|
return a,b
|
|
|
|
pygame.init()
|
|
clock = pygame.time.Clock()
|
|
screen = pygame.display.set_mode([500,500])
|
|
screensize = pygame.display.get_window_size()
|
|
|
|
|
|
|
|
running = True
|
|
if __name__ == "__main__":
|
|
while running:
|
|
for event in pygame.event.get():
|
|
if event.type == pygame.QUIT:
|
|
exit()
|
|
a,b = berechne_dreieck(45,100)
|
|
# draw a
|
|
pygame.draw.line(screen,(255,0,0),(screensize[0]-10,screensize[1]-10),(0,0))
|
|
|
|
# draw b
|
|
pygame.draw.line(screen,(255,0,0),(screensize[0]-10,screensize[1]-10),(0,0))
|
|
|
|
pygame.display.flip()
|
|
clock.tick(60)
|
|
print(berechne_dreieck(45,100)) |