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

18 lines
596 B
Rust
Raw Normal View History

2018-09-21 01:54:12 +08:00
use na::{Real, DefaultAllocator};
use traits::{Dimension, Alloc};
use aliases::TVec;
2018-09-21 01:54:12 +08:00
/// The dot product of the normalized version of `x` and `y`.
pub fn fast_normalize_dot<N: Real, D: Dimension>(x: &TVec<N, D>, y: &TVec<N, D>) -> N
2018-09-21 01:54:12 +08:00
where DefaultAllocator: Alloc<N, D> {
// XXX: improve those.
x.normalize().dot(&y.normalize())
}
/// The dot product of the normalized version of `x` and `y`.
pub fn normalize_dot<N: Real, D: Dimension>(x: &TVec<N, D>, y: &TVec<N, D>) -> N
2018-09-21 01:54:12 +08:00
where DefaultAllocator: Alloc<N, D> {
// XXX: improve those.
x.normalize().dot(&y.normalize())
}