Fix typo.
This commit is contained in:
parent
3e445430a4
commit
5ebb1fa635
@ -141,7 +141,7 @@ pub fn max2<N: Number, D: Dimension>(x: &Vec<N, D>, y: N) -> Vec<N, D>
|
||||
x.map(|x| na::sup(&x, &y))
|
||||
}
|
||||
|
||||
/// Componentwise maximum between `x` and `y`.
|
||||
/// Component-wise maximum between `x` and `y`.
|
||||
pub fn max3<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
na::sup(x, y)
|
||||
@ -158,7 +158,7 @@ pub fn min2<N: Number, D: Dimension>(x: &Vec<N, D>,y: N) -> Vec<N, D>
|
||||
x.map(|x| na::inf(&x, &y))
|
||||
}
|
||||
|
||||
/// Componentwise minimum between `x` and `y`.
|
||||
/// Component-wise minimum between `x` and `y`.
|
||||
pub fn min3<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
na::inf(x, y)
|
||||
@ -171,7 +171,7 @@ pub fn mix<N: Number>(x: N, y: N, a: N) -> N {
|
||||
x * (N::one() - a) + y * a
|
||||
}
|
||||
|
||||
/// Componentwise modulus.
|
||||
/// Component-wise modulus.
|
||||
///
|
||||
/// Returns `x - y * floor(x / y)` for each component in `x` using the corresponding component of `y`.
|
||||
pub fn mod_<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<N, D>
|
||||
@ -184,7 +184,7 @@ pub fn modf<N: Number>(x: N, i: N) -> N {
|
||||
x % i
|
||||
}
|
||||
|
||||
/// Componentwise rounding.
|
||||
/// Component-wise rounding.
|
||||
///
|
||||
/// Values equal to `0.5` are rounded away from `0.0`.
|
||||
pub fn round<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
||||
|
@ -2,13 +2,13 @@ use na::{Real, DefaultAllocator};
|
||||
use aliases::Vec;
|
||||
use traits::{Alloc, Dimension};
|
||||
|
||||
/// Componentwise exponential.
|
||||
/// Component-wise exponential.
|
||||
pub fn exp<N: Real, D: Dimension>(v: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
v.map(|x| x.exp())
|
||||
}
|
||||
|
||||
/// Componentwise base-2 exponential.
|
||||
/// Component-wise base-2 exponential.
|
||||
pub fn exp2<N: Real, D: Dimension>(v: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
v.map(|x| x.exp2())
|
||||
@ -21,25 +21,25 @@ pub fn inversesqrt<N: Real, D: Dimension>(v: &Vec<N, D>) -> Vec<N, D>
|
||||
|
||||
}
|
||||
|
||||
/// Componentwise logarithm.
|
||||
/// Component-wise logarithm.
|
||||
pub fn log<N: Real, D: Dimension>(v: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
v.map(|x| x.ln())
|
||||
}
|
||||
|
||||
/// Componentwise base-2 logarithm.
|
||||
/// Component-wise base-2 logarithm.
|
||||
pub fn log2<N: Real, D: Dimension>(v: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
v.map(|x| x.log2())
|
||||
}
|
||||
|
||||
/// Componentwise power.
|
||||
/// Component-wise power.
|
||||
pub fn pow<N: Real, D: Dimension>(base: &Vec<N, D>, exponent: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
base.zip_map(exponent, |b, e| b.powf(e))
|
||||
}
|
||||
|
||||
/// Componentwise square root.
|
||||
/// Component-wise square root.
|
||||
pub fn sqrt<N: Real, D: Dimension>(v: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
v.map(|x| x.sqrt())
|
||||
|
@ -3,49 +3,49 @@ use na::{self, DefaultAllocator};
|
||||
use traits::{Alloc, Number, Dimension};
|
||||
use aliases::Vec;
|
||||
|
||||
/// Componentwise maximum between a vector and a scalar.
|
||||
/// Component-wise maximum between a vector and a scalar.
|
||||
pub fn max<N: Number, D: Dimension>(a: &Vec<N, D>, b: N) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
a.map(|a| na::sup(&a, &b))
|
||||
}
|
||||
|
||||
/// Componentwise maximum between two vectors.
|
||||
/// Component-wise maximum between two vectors.
|
||||
pub fn max2<N: Number, D: Dimension>(a: &Vec<N, D>, b: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
na::sup(a, b)
|
||||
}
|
||||
|
||||
/// Componentwise maximum between three vectors.
|
||||
/// Component-wise maximum between three vectors.
|
||||
pub fn max3<N: Number, D: Dimension>(a: &Vec<N, D>, b: &Vec<N, D>, c: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
max2(&max2(a, b), c)
|
||||
}
|
||||
|
||||
/// Componentwise maximum between four vectors.
|
||||
/// Component-wise maximum between four vectors.
|
||||
pub fn max4<N: Number, D: Dimension>(a: &Vec<N, D>, b: &Vec<N, D>, c: &Vec<N, D>, d: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
max2(&max2(a, b), &max2(c, d))
|
||||
}
|
||||
|
||||
/// Componentwise maximum between a vector and a scalar.
|
||||
/// Component-wise maximum between a vector and a scalar.
|
||||
pub fn min<N: Number, D: Dimension>(x: &Vec<N, D>, y: N) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.map(|x| na::inf(&x, &y))
|
||||
}
|
||||
|
||||
/// Componentwise maximum between two vectors.
|
||||
/// Component-wise maximum between two vectors.
|
||||
pub fn min2<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
na::inf(x, y)
|
||||
}
|
||||
|
||||
/// Componentwise maximum between three vectors.
|
||||
/// Component-wise maximum between three vectors.
|
||||
pub fn min3<N: Number, D: Dimension>(a: &Vec<N, D>, b: &Vec<N, D>, c: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
min2(&min2(a, b), c)
|
||||
}
|
||||
|
||||
/// Componentwise maximum between four vectors.
|
||||
/// Component-wise maximum between four vectors.
|
||||
pub fn min4<N: Number, D: Dimension>(a: &Vec<N, D>, b: &Vec<N, D>, c: &Vec<N, D>, d: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
min2(&min2(a, b), &min2(c, d))
|
||||
|
@ -4,24 +4,24 @@ use na::DefaultAllocator;
|
||||
use traits::{Alloc, Number, Dimension};
|
||||
use aliases::Vec;
|
||||
|
||||
/// Componentwise approximate equality beween two vectors.
|
||||
/// Component-wise approximate equality beween two vectors.
|
||||
pub fn epsilon_equal<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>, epsilon: N) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.zip_map(y, |x, y| abs_diff_eq!(x, y, epsilon = epsilon))
|
||||
}
|
||||
|
||||
/// Componentwise approximate equality beween two scalars.
|
||||
/// Component-wise approximate equality beween two scalars.
|
||||
pub fn epsilon_equal2<N: AbsDiffEq<Epsilon = N>>(x: N, y: N, epsilon: N) -> bool {
|
||||
abs_diff_eq!(x, y, epsilon = epsilon)
|
||||
}
|
||||
|
||||
/// Componentwise approximate non-equality beween two vectors.
|
||||
/// Component-wise approximate non-equality beween two vectors.
|
||||
pub fn epsilon_not_equal<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>, epsilon: N) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.zip_map(y, |x, y| abs_diff_ne!(x, y, epsilon = epsilon))
|
||||
}
|
||||
|
||||
/// Componentwise approximate non-equality beween two scalars.
|
||||
/// Component-wise approximate non-equality beween two scalars.
|
||||
pub fn epsilon_not_equal2<N: AbsDiffEq<Epsilon = N>>(x: N, y: N, epsilon: N) -> bool {
|
||||
abs_diff_ne!(x, y, epsilon = epsilon)
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ pub fn inverse<N: Real, D: Dimension>(m: &Mat<N, D, D>) -> Mat<N, D, D>
|
||||
m.clone().try_inverse().unwrap_or(Mat::<N, D, D>::zeros())
|
||||
}
|
||||
|
||||
/// Componentwise multiplication of two matrices.
|
||||
/// Component-wise multiplication of two matrices.
|
||||
pub fn matrix_comp_mult<N: Number, R: Dimension, C: Dimension>(x: &Mat<N, R, C>, y: &Mat<N, R, C>) -> Mat<N, R, C>
|
||||
where DefaultAllocator: Alloc<N, R, C> {
|
||||
x.component_mul(y)
|
||||
|
@ -10,22 +10,22 @@ pub fn euler_angles<N: Real>(x: &Qua<N>) -> Vec<N, U3> {
|
||||
Vector3::new(a.2, a.1, a.0)
|
||||
}
|
||||
|
||||
/// Componentwise `>` comparison between two quaternions.
|
||||
/// Component-wise `>` comparison between two quaternions.
|
||||
pub fn greater_than<N: Real>(x: &Qua<N>, y: &Qua<N>) -> Vec<bool, U4> {
|
||||
::greater_than(&x.coords, &y.coords)
|
||||
}
|
||||
|
||||
/// Componentwise `>=` comparison between two quaternions.
|
||||
/// Component-wise `>=` comparison between two quaternions.
|
||||
pub fn greater_than_equal<N: Real>(x: &Qua<N>, y: &Qua<N>) -> Vec<bool, U4> {
|
||||
::greater_than_equal(&x.coords, &y.coords)
|
||||
}
|
||||
|
||||
/// Componentwise `<` comparison between two quaternions.
|
||||
/// Component-wise `<` comparison between two quaternions.
|
||||
pub fn less_than<N: Real>(x: &Qua<N>, y: &Qua<N>) -> Vec<bool, U4> {
|
||||
::less_than(&x.coords, &y.coords)
|
||||
}
|
||||
|
||||
/// Componentwise `<=` comparison between two quaternions.
|
||||
/// Component-wise `<=` comparison between two quaternions.
|
||||
pub fn less_than_equal<N: Real>(x: &Qua<N>, y: &Qua<N>) -> Vec<bool, U4> {
|
||||
::less_than_equal(&x.coords, &y.coords)
|
||||
}
|
||||
|
@ -3,22 +3,22 @@ use na::{Real, U4};
|
||||
|
||||
use aliases::{Qua, Vec};
|
||||
|
||||
/// Componentwise equality comparison between two quaternions.
|
||||
/// Component-wise equality comparison between two quaternions.
|
||||
pub fn equal<N: Real>(x: &Qua<N>, y: &Qua<N>) -> Vec<bool, U4> {
|
||||
::equal(&x.coords, &y.coords)
|
||||
}
|
||||
|
||||
/// Componentwise approximate equality comparison between two quaternions.
|
||||
/// Component-wise approximate equality comparison between two quaternions.
|
||||
pub fn equal_eps<N: Real>(x: &Qua<N>, y: &Qua<N>, epsilon: N) -> Vec<bool, U4> {
|
||||
::equal_eps(&x.coords, &y.coords, epsilon)
|
||||
}
|
||||
|
||||
/// Componentwise non-equality comparison between two quaternions.
|
||||
/// Component-wise non-equality comparison between two quaternions.
|
||||
pub fn not_equal<N: Real>(x: &Qua<N>, y: &Qua<N>) -> Vec<bool, U4> {
|
||||
::not_equal(&x.coords, &y.coords)
|
||||
}
|
||||
|
||||
/// Componentwise approximate non-equality comparison between two quaternions.
|
||||
/// Component-wise approximate non-equality comparison between two quaternions.
|
||||
pub fn not_equal_eps<N: Real>(x: &Qua<N>, y: &Qua<N>, epsilon: N) -> Vec<bool, U4> {
|
||||
::not_equal_eps(&x.coords, &y.coords, epsilon)
|
||||
}
|
||||
|
@ -4,91 +4,91 @@ use aliases::Vec;
|
||||
use traits::{Alloc, Dimension};
|
||||
|
||||
|
||||
/// Componentwise arc-cosinus.
|
||||
/// Component-wise arc-cosinus.
|
||||
pub fn acos<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.map(|e| e.acos())
|
||||
}
|
||||
|
||||
/// Componentwise hyperbolic arc-cosinus.
|
||||
/// Component-wise hyperbolic arc-cosinus.
|
||||
pub fn acosh<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.map(|e| e.acosh())
|
||||
}
|
||||
|
||||
/// Componentwise arc-sinus.
|
||||
/// Component-wise arc-sinus.
|
||||
pub fn asin<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.map(|e| e.asin())
|
||||
}
|
||||
|
||||
/// Componentwise hyperbolic arc-sinus.
|
||||
/// Component-wise hyperbolic arc-sinus.
|
||||
pub fn asinh<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.map(|e| e.asinh())
|
||||
}
|
||||
|
||||
/// Componentwise arc-tangent of `y / x`.
|
||||
/// Component-wise arc-tangent of `y / x`.
|
||||
pub fn atan2<N: Real, D: Dimension>(y: &Vec<N, D>, x: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
y.zip_map(x, |y, x| y.atan2(x))
|
||||
}
|
||||
|
||||
/// Componentwise arc-tangent.
|
||||
/// Component-wise arc-tangent.
|
||||
pub fn atan<N: Real, D: Dimension>(y_over_x: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
y_over_x.map(|e| e.atan())
|
||||
}
|
||||
|
||||
/// Componentwise hyperbolic arc-tangent.
|
||||
/// Component-wise hyperbolic arc-tangent.
|
||||
pub fn atanh<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.map(|e| e.atanh())
|
||||
}
|
||||
|
||||
/// Componentwise cosinus.
|
||||
/// Component-wise cosinus.
|
||||
pub fn cos<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
angle.map(|e| e.cos())
|
||||
}
|
||||
|
||||
/// Componentwise hyperbolic cosinus.
|
||||
/// Component-wise hyperbolic cosinus.
|
||||
pub fn cosh<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
angle.map(|e| e.cosh())
|
||||
}
|
||||
|
||||
/// Componentwise conversion from radians to degrees.
|
||||
/// Component-wise conversion from radians to degrees.
|
||||
pub fn degrees<N: Real, D: Dimension>(radians: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
radians.map(|e| e * na::convert(180.0) / N::pi())
|
||||
}
|
||||
|
||||
/// Componentwise conversion fro degrees to radians.
|
||||
/// Component-wise conversion fro degrees to radians.
|
||||
pub fn radians<N: Real, D: Dimension>(degrees: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
degrees.map(|e| e * N::pi() / na::convert(180.0))
|
||||
}
|
||||
|
||||
/// Componentwise sinus.
|
||||
/// Component-wise sinus.
|
||||
pub fn sin<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
angle.map(|e| e.sin())
|
||||
}
|
||||
|
||||
/// Componentwise hyperbolic sinus.
|
||||
/// Component-wise hyperbolic sinus.
|
||||
pub fn sinh<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
angle.map(|e| e.sinh())
|
||||
}
|
||||
|
||||
/// Componentwise tangent.
|
||||
/// Component-wise tangent.
|
||||
pub fn tan<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
angle.map(|e| e.tan())
|
||||
}
|
||||
|
||||
/// Componentwise hyperbolic tangent.
|
||||
/// Component-wise hyperbolic tangent.
|
||||
pub fn tanh<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
angle.map(|e| e.tanh())
|
||||
|
@ -15,43 +15,43 @@ pub fn any<D: Dimension>(v: &Vec<bool, D>) -> bool
|
||||
v.iter().any(|x| *x)
|
||||
}
|
||||
|
||||
/// Componentwise equality comparison.
|
||||
/// Component-wise equality comparison.
|
||||
pub fn equal<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.zip_map(y, |x, y| x == y)
|
||||
}
|
||||
|
||||
/// Componentwise `>` comparison.
|
||||
/// Component-wise `>` comparison.
|
||||
pub fn greater_than<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.zip_map(y, |x, y| x > y)
|
||||
}
|
||||
|
||||
/// Componentwise `>=` comparison.
|
||||
/// Component-wise `>=` comparison.
|
||||
pub fn greater_than_equal<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.zip_map(y, |x, y| x >= y)
|
||||
}
|
||||
|
||||
/// Componentwise `<` comparison.
|
||||
/// Component-wise `<` comparison.
|
||||
pub fn less_than<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.zip_map(y, |x, y| x < y)
|
||||
}
|
||||
|
||||
/// Componentwise `>=` comparison.
|
||||
/// Component-wise `>=` comparison.
|
||||
pub fn less_than_equal<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.zip_map(y, |x, y| x <= y)
|
||||
}
|
||||
|
||||
/// Componentwise not `!`.
|
||||
/// Component-wise not `!`.
|
||||
pub fn not<D: Dimension>(v: &Vec<bool, D>) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<bool, D> {
|
||||
v.map(|x| !x)
|
||||
}
|
||||
|
||||
/// Componentwise not-equality `!=`.
|
||||
/// Component-wise not-equality `!=`.
|
||||
pub fn not_equal<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<bool, D>
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
x.zip_map(y, |x, y| x != y)
|
||||
|
Loading…
Reference in New Issue
Block a user