Trait pasture_core::math::MinMax[][src]

pub trait MinMax {
    fn infimum(&self, other: &Self) -> Self;
fn supremum(&self, other: &Self) -> Self; }

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));
Loading content...

Implementations on Foreign Types

impl MinMax for u8[src]

impl MinMax for u16[src]

impl MinMax for u32[src]

impl MinMax for u64[src]

impl MinMax for i8[src]

impl MinMax for i16[src]

impl MinMax for i32[src]

impl MinMax for i64[src]

impl MinMax for bool[src]

impl MinMax for f32[src]

impl MinMax for f64[src]

impl<T: MinMax + Scalar> MinMax for Vector3<T>[src]

Loading content...

Implementors

Loading content...