2018-09-21 01:54:12 +08:00
|
|
|
use na::{Real, DefaultAllocator};
|
|
|
|
|
|
|
|
use traits::{Dimension, Alloc};
|
2018-09-23 20:48:45 +08:00
|
|
|
use aliases::TVec;
|
2018-09-21 01:54:12 +08:00
|
|
|
|
2018-09-22 19:18:59 +08:00
|
|
|
/// The dot product of the normalized version of `x` and `y`.
|
2018-09-23 20:48:45 +08:00
|
|
|
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())
|
|
|
|
}
|
|
|
|
|
2018-09-22 19:18:59 +08:00
|
|
|
/// The dot product of the normalized version of `x` and `y`.
|
2018-09-23 20:48:45 +08:00
|
|
|
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())
|
|
|
|
}
|