[−][src]Function moore_hilbert::coordinates_compare
pub fn coordinates_compare(
bits_per_dimension: BitsPerDimensionType,
coord1: &[HilbertCoordinate],
coord2: &[HilbertCoordinate]
) -> Ordering
Determine which of two points lies further along the Hilbert curve
Arguments
bits_per_dimension
- Number of bits/coordinate.coord1
- Slice of coordinatescoord2
- Slice of coordinates
Returns
- Ordering result that indicates the comparison of coord1 and coord2
Assumptions
nBits
<= (sizeof HilbertIndex
) * bits_per_byte
Example
use std::cmp::Ordering; let coords = vec![ vec![1,2,3], vec![1,2,4], ]; let bits_per_dimension = 4; assert_eq!(moore_hilbert::coordinates_compare(bits_per_dimension, &coords[0], &coords[1]), Ordering::Less); assert_eq!(moore_hilbert::coordinates_compare(bits_per_dimension, &coords[0], &coords[0]), Ordering::Equal); assert_eq!(moore_hilbert::coordinates_compare(bits_per_dimension, &coords[1], &coords[0]), Ordering::Greater);