lyon_geom::utils

Function directed_angle

source
pub fn directed_angle<S: Scalar>(v1: Vector<S>, v2: Vector<S>) -> S
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-