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