bogemaß war das problem

This commit is contained in:
Michael S. 2024-01-21 19:57:30 +01:00
parent 9d989a52a6
commit bc77e0617f

View file

@ -1,10 +1,11 @@
#!/usr/bin/python3 #!/usr/bin/python3
from math import sin,cos from math import sin,cos,radians
from time import sleep from time import sleep
import pygame import pygame
def berechne_dreieck(alpha,c): def berechne_dreieck(alpha,c):
alpha = radians(alpha)
a = cos(alpha)*c# x a = cos(alpha)*c# x
b = sin(alpha)*c# y b = -sin(alpha)*c# y
return a,b return a,b
def get_debug_text(): def get_debug_text():
@ -49,16 +50,16 @@ if __name__ == "__main__":
screen.fill((0,0,0)) screen.fill((0,0,0))
if winkel >= 360 or winkel <= -1: if winkel >= 360 or winkel <= -1:
winkel = 0 winkel = 0
a,b = berechne_dreieck(winkel,150) a,b = berechne_dreieck(winkel,200)#screensize[0]*screensize[1])
end_pos = start_pos[0]+a,start_pos[1]+b end_pos = start_pos[0]+a,start_pos[1]+b
# draw c schwarz # draw c schwarz
pygame.draw.line(screen,(0,0,0),start_pos,end_pos) pygame.draw.line(screen,(0,0,0),start_pos,end_pos,3)
# draw a rot # draw a rot
pygame.draw.line(screen,(255,0,0),start_pos,(start_pos[0]+a,start_pos[1])) pygame.draw.line(screen,(255,0,0),start_pos,(start_pos[0]+a,start_pos[1]),3)
# draw b blau # draw b blau
pygame.draw.line(screen,(0,0,255),(start_pos[0]+a,start_pos[1]),(start_pos[0]+a,start_pos[1]+b)) pygame.draw.line(screen,(0,0,255),(start_pos[0]+a,start_pos[1]),(start_pos[0]+a,start_pos[1]+b),3)
get_debug_text() get_debug_text()
pygame.display.flip() pygame.display.flip()