Trait pasture_core::math::MinMax [−][src]
Helper trait for computing minimum and maximum values for types. This is used in conjunction
with PrimitiveType
to enable min/max computations even for vector types
Required methods
fn infimum(&self, other: &Self) -> Self
[src]
Computes the infimum of this value and other
. For scalar types, the infimum is simply the
minimum of the two types (as defined by PartialOrd
), for vector types, this is the component-wise
minimum
Example
use pasture_core::math::MinMax; assert_eq!(5i32.infimum(&3i32), 3i32); assert_eq!(Vector3::new(1.0, 2.0, 3.0).infimum(&Vector3::new(2.0, 1.0, 0.0)), Vector3::new(1.0, 1.0, 0.0));
fn supremum(&self, other: &Self) -> Self
[src]
Computes the supremum of this value and other
. For scalar types, the infimum is simply the
maximum of the two types (as defined by PartialOrd
), for vector types, this is the component-wise
maximum
Example
use pasture_core::math::MinMax; assert_eq!(5i32.supremum(&3i32), 5i32); assert_eq!(Vector3::new(1.0, 2.0, 3.0).supremum(&Vector3::new(2.0, 1.0, 4.0)), Vector3::new(2.0, 2.0, 4.0));