2018-09-22 23:36:08 +08:00
|
|
|
// NOTE those are actually duplicates of vector_relational.rs
|
|
|
|
|
|
|
|
/*
|
2018-09-22 19:18:59 +08:00
|
|
|
use approx::AbsDiffEq;
|
|
|
|
use na::DefaultAllocator;
|
|
|
|
|
|
|
|
use traits::{Alloc, Number, Dimension};
|
2018-09-23 20:48:45 +08:00
|
|
|
use aliases::TVec;
|
2018-09-22 19:18:59 +08:00
|
|
|
|
2018-09-22 19:21:02 +08:00
|
|
|
/// Component-wise approximate equality beween two vectors.
|
2018-09-23 20:48:45 +08:00
|
|
|
pub fn epsilon_equal<N: Number, D: Dimension>(x: &TVec<N, D>, y: &TVec<N, D>, epsilon: N) -> TVec<bool, D>
|
2018-09-22 19:18:59 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
x.zip_map(y, |x, y| abs_diff_eq!(x, y, epsilon = epsilon))
|
|
|
|
}
|
|
|
|
|
2018-09-22 19:21:02 +08:00
|
|
|
/// Component-wise approximate equality beween two scalars.
|
2018-09-22 19:18:59 +08:00
|
|
|
pub fn epsilon_equal2<N: AbsDiffEq<Epsilon = N>>(x: N, y: N, epsilon: N) -> bool {
|
|
|
|
abs_diff_eq!(x, y, epsilon = epsilon)
|
|
|
|
}
|
|
|
|
|
2018-09-22 19:21:02 +08:00
|
|
|
/// Component-wise approximate non-equality beween two vectors.
|
2018-09-23 20:48:45 +08:00
|
|
|
pub fn epsilon_not_equal<N: Number, D: Dimension>(x: &TVec<N, D>, y: &TVec<N, D>, epsilon: N) -> TVec<bool, D>
|
2018-09-22 19:18:59 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
x.zip_map(y, |x, y| abs_diff_ne!(x, y, epsilon = epsilon))
|
|
|
|
}
|
|
|
|
|
2018-09-22 19:21:02 +08:00
|
|
|
/// Component-wise approximate non-equality beween two scalars.
|
2018-09-22 19:18:59 +08:00
|
|
|
pub fn epsilon_not_equal2<N: AbsDiffEq<Epsilon = N>>(x: N, y: N, epsilon: N) -> bool {
|
|
|
|
abs_diff_ne!(x, y, epsilon = epsilon)
|
|
|
|
}
|
2018-10-22 04:11:27 +08:00
|
|
|
*/
|