Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
A version of VectorAngle for 2D vectors that can return negative angles
| ResourceFunction["SignedVectorAngle"][u,v] gives the angle between the 2D vectors u and v, returning a positive number if v is counterclockwise relative to u and negative if clockwise. | 
Return the angle between two vectors:
| In[1]:= | ![ResourceFunction["SignedVectorAngle"][{1, 0}, {0, 1}]](https://www.wolframcloud.com/obj/resourcesystem/images/b8d/b8d85d4a-1136-40fd-86d5-deeb38701c54/6b751f91ea9be413.png) | 
| Out[1]= |  | 
If the second vector is clockwise from the first vector, the result is negative:
| In[2]:= | ![ResourceFunction["SignedVectorAngle"][{0, 1}, {1, 0}]](https://www.wolframcloud.com/obj/resourcesystem/images/b8d/b8d85d4a-1136-40fd-86d5-deeb38701c54/5f1b174ae3418d3a.png) | 
| Out[2]= |  | 
The absolute value of SignedVectorAngle is always the same as VectorAngle:
| In[3]:= | ![Abs[ResourceFunction["SignedVectorAngle"][{0, 1}, {1, 0}]]](https://www.wolframcloud.com/obj/resourcesystem/images/b8d/b8d85d4a-1136-40fd-86d5-deeb38701c54/37979448de1e0b63.png) | 
| Out[3]= |  | 
| In[4]:= | ![VectorAngle[{0, 1}, {1, 0}]](https://www.wolframcloud.com/obj/resourcesystem/images/b8d/b8d85d4a-1136-40fd-86d5-deeb38701c54/14f024999cc5b235.png) | 
| Out[4]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License