I have been not using math for a long time and this should be a simple problem to solve.
Suppose I have two points A: (1, 0) and B: (1, -1).
I want to use a program (Python or whatever programming language) to calculate the clockwise angle between A, origin (0, 0) and B. It will be something like this:
angle_clockwise(point1, point2)
Note that the order of the parameters matters. Since the angle calculation will be clockwise:
- If I call angle_clockwise(A, B), it returns 45.
- If I call angle_clockwise(B, A), it returns 315.
In other words, the algorithm is like this:
- Draw a line (line 1) between the first point param with (0, 0).
- Draw a line (line 2) between the second point param with (0, 0).
- Revolve line 1 around (0, 0) clockwise until it overlaps line 2.
- The angular distance line 1 traveled will be the returned angle.
Is there any way to code this problem?