Around 20 coordinates of a vehicle's location are mentioned. Everytime the car turns, at what angle does it turn? How to determine the angle? Is there any particular formula to get the angle using coordinates only?
I tried coding it in Python:
def turn_angle(x2, y2, x1, y1, rotation=0, clockwise=False):
angle = degrees(atan2(y2-y1, x2-x1)) - rotation
if not clockwise:
angle = -angle
return angle % 360
Is the above function correct? Or is there any other alternative method to calculate?
A few coordinates of the vehicle are:
(0,0), (-0.2,-0.5), (-0.2,-0.5), (-0.1,-0.6), (0.3,-0.2),(1.2,0),
(2.6,-0.5), (4.3,-1.2), (5.5,-2.7), (6.5,-4.8), (6.7,-7.8), (5.7,-11.2),
(3.9,-14.8), (2.2,-17.8), (0.5,-20.8), (-2.1,-24.7), (-4.9,-30), (-8.5,-37.1),
(-11.9,-44.7), (-14.7,-52.8), (-17.7,-61.8), (-19.9,-70.9), (-21.5,-80), (-23.3,-89.4),
(-24.9,-97.9), (-26.6,-105.6), (-27.8,-112.3), (-28.6,-117.7), (-28.8,-120.1)



The problem doesn't seem well-defined. How many turns and by what angle can you see in these four points?