2018-09-20 20:23:31 +08:00
|
|
|
use na::{self, Real, DefaultAllocator};
|
2018-09-20 16:50:34 +08:00
|
|
|
|
|
|
|
use aliases::Vec;
|
2018-09-20 20:23:31 +08:00
|
|
|
use traits::{Alloc, Dimension};
|
2018-09-20 16:50:34 +08:00
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn acos<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
x.map(|e| e.acos())
|
|
|
|
}
|
2018-09-20 20:23:31 +08:00
|
|
|
|
|
|
|
pub fn acosh<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
x.map(|e| e.acosh())
|
|
|
|
}
|
2018-09-20 20:23:31 +08:00
|
|
|
|
|
|
|
pub fn asin<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
x.map(|e| e.asin())
|
|
|
|
}
|
2018-09-20 20:23:31 +08:00
|
|
|
|
|
|
|
pub fn asinh<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
x.map(|e| e.asinh())
|
|
|
|
}
|
2018-09-20 20:23:31 +08:00
|
|
|
|
|
|
|
pub fn atan2<N: Real, D: Dimension>(y: &Vec<N, D>, x: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
y.zip_map(x, |y, x| y.atan2(x))
|
|
|
|
}
|
2018-09-20 20:23:31 +08:00
|
|
|
|
|
|
|
pub fn atan<N: Real, D: Dimension>(y_over_x: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
y_over_x.map(|e| e.atan())
|
|
|
|
}
|
2018-09-20 20:23:31 +08:00
|
|
|
|
|
|
|
pub fn atanh<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
x.map(|e| e.atanh())
|
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn cos<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
angle.map(|e| e.cos())
|
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn cosh<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
angle.map(|e| e.cosh())
|
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn degrees<N: Real, D: Dimension>(radians: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
radians.map(|e| e * na::convert(180.0) / N::pi())
|
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn radians<N: Real, D: Dimension>(degrees: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
degrees.map(|e| e * N::pi() / na::convert(180.0))
|
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn sin<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
angle.map(|e| e.sin())
|
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn sinh<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
angle.map(|e| e.sinh())
|
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn tan<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
angle.map(|e| e.tan())
|
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn tanh<N: Real, D: Dimension>(angle: &Vec<N, D>) -> Vec<N, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D> {
|
|
|
|
angle.map(|e| e.tanh())
|
2018-09-20 20:23:31 +08:00
|
|
|
}
|