Function directed_angle
pub fn directed_angle<S>(
v1: Vector2D<S, UnknownUnit>,
v2: Vector2D<S, UnknownUnit>,
) -> Swhere
S: Scalar,
Available on crate feature
canvas
only.Expand description
Angle between vectors v1 and v2 (oriented clockwise assuming y points downwards).
The result is a number between 0
and 2 * PI
.
ex: directed_angle([0,1], [1,0]) = 3/2 Pi rad
x __
0--> / \
y| | x--> v2
v \ |v1
v
Or, assuming y points upwards:
directed_angle([0,-1], [1,0]) = 1/2 Pi rad
^ v2
y| x-->
0--> v1 | /
x v-