nalgebra/nalgebra-glm/src/ext/scalar_common.rs

23 lines
578 B
Rust
Raw Normal View History

2018-09-21 01:54:12 +08:00
use na;
2018-09-21 01:54:12 +08:00
use traits::Number;
/// Returns the maximum value among three.
2018-09-21 01:54:12 +08:00
pub fn max3<N: Number>(a: N, b: N, c: N) -> N {
na::sup(&na::sup(&a, &b), &c)
}
/// Returns the maximum value among four.
2018-09-21 01:54:12 +08:00
pub fn max4<N: Number>(a: N, b: N, c: N, d: N) -> N {
na::sup(&na::sup(&a, &b), &na::sup(&c, &d))
}
/// Returns the maximum value among three.
2018-09-21 01:54:12 +08:00
pub fn min3<N: Number>(a: N, b: N, c: N) -> N {
na::inf(&na::inf(&a, &b), &c)
}
/// Returns the maximum value among four.
2018-09-21 01:54:12 +08:00
pub fn min4<N: Number>(a: N, b: N, c: N, d: N) -> N {
na::inf(&na::inf(&a, &b), &na::inf(&c, &d))
}