It is necessary to calculate the angle of inclination of the segment, but taking into account the location of the beginning and end.
import math trox = float(3.0) troy = float(3.0) rxox = float(7.0) rxoy = float(5.0) len_line = math.sqrt(((rxox-trox)**2)+((rxoy-troy)**2)) print('%.3f' % len_line) angel = math.degrees(math.atan((rxoy-troy)/(rxox-trox))) print('%.3f' % angel) In the above code, the beginning of the segment is lower and to the left than the end. Because the angle is 26 degrees. It seems everything is clear. But if you swap the beginning and end of the segment, the angle value will be exactly the same. And I need to take into account the direction of the segment around its beginning. Theoretically, the angle should be 206 degrees. How to implement it?