Function glm::ext::angle
[−]
[src]
pub fn angle<F: BaseFloat + GenFloat<F>, T: GenFloatVec<F>>(x: T, y: T) -> F
Returns angle between vectors x
and y
.
The return value is in radian unit and in the interval [0, π].
Note
x
andy
need be normalized to get meaningful result.- If either
x
ory
is zero, the angle is undefined, and0
is returned.
Example
use glm::*; use glm::ext::*; let vx = vec2(1., 0.); let vy = vec2(0., 1.); assert!(is_approx_eq(&angle(vx, vy), &half_pi())); assert!(is_approx_eq(&angle(vy, vx), &half_pi()));