use na::{self, DefaultAllocator}; use traits::{Alloc, Number, Dimension}; use aliases::TVec; /// Component-wise maximum between a vector and a scalar. /// /// # See also: /// /// * [`comp_max`](fn.comp_max.html) /// * [`comp_min`](fn.comp_min.html) /// * [`max2`](fn.max2.html) /// * [`max3`](fn.max3.html) /// * [`max4`](fn.max4.html) /// * [`min`](fn.min.html) /// * [`min2`](fn.min2.html) /// * [`min3`](fn.min3.html) /// * [`min4`](fn.min4.html) pub fn max(a: &TVec, b: N) -> TVec where DefaultAllocator: Alloc { a.map(|a| na::sup(&a, &b)) } /// Component-wise maximum between two vectors. /// /// # See also: /// /// * [`comp_max`](fn.comp_max.html) /// * [`comp_min`](fn.comp_min.html) /// * [`max`](fn.max.html) /// * [`max3`](fn.max3.html) /// * [`max4`](fn.max4.html) /// * [`min`](fn.min.html) /// * [`min2`](fn.min2.html) /// * [`min3`](fn.min3.html) /// * [`min4`](fn.min4.html) pub fn max2(a: &TVec, b: &TVec) -> TVec where DefaultAllocator: Alloc { na::sup(a, b) } /// Component-wise maximum between three vectors. /// /// # See also: /// /// * [`comp_max`](fn.comp_max.html) /// * [`comp_min`](fn.comp_min.html) /// * [`max`](fn.max.html) /// * [`max2`](fn.max2.html) /// * [`max4`](fn.max4.html) /// * [`min`](fn.min.html) /// * [`min2`](fn.min2.html) /// * [`min3`](fn.min3.html) /// * [`min4`](fn.min4.html) pub fn max3(a: &TVec, b: &TVec, c: &TVec) -> TVec where DefaultAllocator: Alloc { max2(&max2(a, b), c) } /// Component-wise maximum between four vectors. /// /// # See also: /// /// * [`comp_max`](fn.comp_max.html) /// * [`comp_min`](fn.comp_min.html) /// * [`max`](fn.max.html) /// * [`max2`](fn.max2.html) /// * [`max3`](fn.max3.html) /// * [`min`](fn.min.html) /// * [`min2`](fn.min2.html) /// * [`min3`](fn.min3.html) /// * [`min4`](fn.min4.html) pub fn max4(a: &TVec, b: &TVec, c: &TVec, d: &TVec) -> TVec where DefaultAllocator: Alloc { max2(&max2(a, b), &max2(c, d)) } /// Component-wise minimum between a vector and a scalar. /// /// # See also: /// /// * [`comp_max`](fn.comp_max.html) /// * [`comp_min`](fn.comp_min.html) /// * [`max`](fn.max.html) /// * [`max2`](fn.max2.html) /// * [`max3`](fn.max3.html) /// * [`max4`](fn.max4.html) /// * [`min2`](fn.min2.html) /// * [`min3`](fn.min3.html) /// * [`min4`](fn.min4.html) pub fn min(x: &TVec, y: N) -> TVec where DefaultAllocator: Alloc { x.map(|x| na::inf(&x, &y)) } /// Component-wise minimum between two vectors. /// /// # See also: /// /// * [`comp_max`](fn.comp_max.html) /// * [`comp_min`](fn.comp_min.html) /// * [`max`](fn.max.html) /// * [`max2`](fn.max2.html) /// * [`max3`](fn.max3.html) /// * [`max4`](fn.max4.html) /// * [`min`](fn.min.html) /// * [`min3`](fn.min3.html) /// * [`min4`](fn.min4.html) pub fn min2(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { na::inf(x, y) } /// Component-wise minimum between three vectors. /// /// # See also: /// /// * [`comp_max`](fn.comp_max.html) /// * [`comp_min`](fn.comp_min.html) /// * [`max`](fn.max.html) /// * [`max2`](fn.max2.html) /// * [`max3`](fn.max3.html) /// * [`max4`](fn.max4.html) /// * [`min`](fn.min.html) /// * [`min2`](fn.min2.html) /// * [`min4`](fn.min4.html) pub fn min3(a: &TVec, b: &TVec, c: &TVec) -> TVec where DefaultAllocator: Alloc { min2(&min2(a, b), c) } /// Component-wise minimum between four vectors. /// /// # See also: /// /// * [`comp_max`](fn.comp_max.html) /// * [`comp_min`](fn.comp_min.html) /// * [`max`](fn.max.html) /// * [`max2`](fn.max2.html) /// * [`max3`](fn.max3.html) /// * [`max4`](fn.max4.html) /// * [`min`](fn.min.html) /// * [`min2`](fn.min2.html) /// * [`min3`](fn.min3.html) pub fn min4(a: &TVec, b: &TVec, c: &TVec, d: &TVec) -> TVec where DefaultAllocator: Alloc { min2(&min2(a, b), &min2(c, d)) }