ist mein erster Post in diesem Forum. Hoffe ich mache alles richtig.
Ich habe eine If-Schleife geschrieben die bei einer falschen Bedingung ausgelöst wird. Im Bild unten habe ich den Debugger drüberlaufen lassen und ich kann mir einfach nicht erklären warum die erste If-Schleife ausgeführt wird.
Hoffe ihr könnt mir helfen. Bin noch Neuling in Python und offen für Tipps.
Gruß
Janik
Code: Alles auswählen
def punkte_Kreisbogen(inputGCodeKreis):
"""
Ähnliche Funktion wie Kreislänge bestimmen. Unterteilt Kreis in gleichmäßig verteilte Punkte anhand des Bogenmaßes
:param inputGCodeKreis:
:return:
"""
# Kreis parametrisieren
start = [position[0], position[1]] #start = np.array([position[0], position[1], position[2], position[3]])
ende = [inputGCodeKreis[1], inputGCodeKreis[2]]
mittelpunkt = [inputGCodeKreis[3] + start[0], inputGCodeKreis[4] + start[1]]
radius = np.hypot(ende[0] - mittelpunkt[0], ende[1] - mittelpunkt[1])
global schritt_Rest
# Winkelberechnung, alle Winkel werden in Grad ausgegeben
if ((start[0] - mittelpunkt[0]) > 0) and ((start[1] - mittelpunkt[1]) >= 0): # x>0 und y>=0 --> arctan(y/x)
startWinkel = np.degrees(np.arctan((start[1] - mittelpunkt[1]) / (start[0] - mittelpunkt[0])))
elif start[0] - mittelpunkt[0] > 0 and start[1] - mittelpunkt[1] < 0: # x>0 und y<0 --> arctan(y/x) + 2pi
startWinkel = np.degrees(np.arctan((start[1] - mittelpunkt[1]) / (start[0] - mittelpunkt[0]))) + 360
elif start[0] - mittelpunkt[0] == 0 and start[1] - mittelpunkt[1] < 0: # x=0 und y<0 --> 270
startWinkel = 270.0
elif start[0] - mittelpunkt[0] == 0 and start[1] - mittelpunkt[1] > 0: # x=0 und y<0 --> 90
startWinkel = 90.0
elif start[0] - mittelpunkt[0] < 0: # x<0 --> arctan(y/x) + pi
startWinkel = np.degrees(np.arctan((start[1] - mittelpunkt[1]) / (start[0] - mittelpunkt[0]))) + 180