I have written a program so a rectangle sequentially moves in the direction of many vectors. Arbitrary Example.
How can I calculate the angle by which the surface must rotate so it is "looking" in the direction of the vector that it is travelling along.
def __FindAngle(self, previous, next):
angle2 = -math.degrees(math.atan2(next.y, next.x))
angle1 = -math.degrees(math.atan2(previous.y, previous.x))
if angle1 == angle2:
return 0
return round(angle2 - angle1 - self.TaxiCorrection)
This is my current attempt in doing so where previous is the previous vector of its path and next is the next vector of its path. (self.TaxiCorrection is the correction angle depending on the image's orientation)
I'm new to stack overflow so apologies if my question is not as clear.