nalgebra/nalgebra-glm/src/gtx/normalize_dot.rs

29 lines
823 B
Rust
Raw Normal View History

2018-10-22 04:11:27 +08:00
use na::{DefaultAllocator, Real};
2018-09-21 01:54:12 +08:00
use aliases::TVec;
2018-10-22 04:11:27 +08:00
use traits::{Alloc, Dimension};
2018-09-21 01:54:12 +08:00
/// The dot product of the normalized version of `x` and `y`.
2018-10-08 10:30:16 +08:00
///
/// This is currently the same as [`normalize_dot`](fn.normalize_dot.html).
///
/// # See also:
///
/// * [`normalize_dot`](fn.normalize_dot.html`)
pub fn fast_normalize_dot<N: Real, D: Dimension>(x: &TVec<N, D>, y: &TVec<N, D>) -> N
2018-10-22 13:00:10 +08:00
where DefaultAllocator: Alloc<N, D> {
2018-09-21 01:54:12 +08:00
// XXX: improve those.
x.normalize().dot(&y.normalize())
}
/// The dot product of the normalized version of `x` and `y`.
2018-10-08 10:30:16 +08:00
///
/// # See also:
///
/// * [`fast_normalize_dot`](fn.fast_normalize_dot.html`)
pub fn normalize_dot<N: Real, D: Dimension>(x: &TVec<N, D>, y: &TVec<N, D>) -> N
2018-10-22 13:00:10 +08:00
where DefaultAllocator: Alloc<N, D> {
2018-09-21 01:54:12 +08:00
// XXX: improve those.
x.normalize().dot(&y.normalize())
2018-10-08 10:30:16 +08:00
}