Function sort2

Source
pub fn sort2<T: PartialOrd + Copy>(a: T, b: T) -> (T, T)
Expand description

Sorts a set of two values in increasing order.

This is a simple utility function that takes two values and returns them as a tuple in sorted order (smallest first). This function is only available in 3D mode (dim3 feature).

§Arguments

  • a - The first value
  • b - The second value

§Returns

A tuple (min, max) where min is the smaller value and max is the larger value.

§Examples

use parry3d::utils::sort2;

let (min, max) = sort2(5.0, 2.0);
assert_eq!(min, 2.0);
assert_eq!(max, 5.0);

// Already sorted values remain in the same order
let (min, max) = sort2(1.0, 3.0);
assert_eq!(min, 1.0);
assert_eq!(max, 3.0);