Skip to main content

Z2

Struct Z2 

Source
pub struct Z2 { /* private fields */ }
Expand description

A two dimensional Z-Order curve.

Implementations§

Source§

impl Z2

Source

pub fn new(x: u32, y: u32) -> Self

Constructor for Z2 from values from dimension-1 and dimension-2.

Source

pub fn new_from_zorder(zorder: u64) -> Self

Create a Z2 directly from the z value.

Source

pub fn z(&self) -> u64

Index value.

Source

pub fn decode(&self) -> (u32, u32)

Return the user space (un-z-order indexed) values.

Trait Implementations§

Source§

impl Debug for Z2

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Z2

Source§

impl Ord for Z2

Source§

fn cmp(&self, other: &Z2) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Z2

Source§

fn eq(&self, other: &Z2) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Z2

Source§

fn partial_cmp(&self, other: &Z2) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Z2

Source§

impl ZN for Z2

Source§

const DIMENSIONS: u64 = 2

Number of Dimensions.
Source§

const BITS_PER_DIMENSION: u32 = 31

Number of Bits per Dimension.
Source§

const TOTAL_BITS: u64

Total bits used. Usually bits_per_dim * dim.
Source§

const MAX_MASK: u64 = 0x7fff_ffff

MAX Value of this Z-order.
Source§

fn split(value: u32) -> u64

Insert (DIMENSIONS - 1) zeros between each bit to create a zvalue from a single dimension. Read more
Source§

fn combine(z: u64) -> u32

Combine every (Dimensions - 1) bits to re-create a single dimension. Opposite of split.
Source§

fn contains(range: ZRange, value: u64) -> bool

Tests whether range contains the value. Considers User space.
Source§

fn overlaps(range: ZRange, value: ZRange) -> bool

Test whether range and value overlap. Considers User space. Read more
Source§

const QUADRANTS: u32 = _

Number of quadrants in the quad/oct tree.
Source§

fn contains_value(range: ZRange, value: ZRange) -> bool

Test whether range contains the value. Considers User space.
Source§

fn zranges_default<Z: ZN>(zbounds: &[ZRange]) -> Vec<Box<dyn IndexRange>>

Compute the Z-index ranges that cover zbounds (Default values: precision = 64, max_recurse = 7, max_ranges = usize::MAX).
Source§

fn zranges<Z: ZN>( zbounds: &[ZRange], precision: u64, max_ranges: Option<usize>, max_recurse: Option<usize>, ) -> Vec<Box<dyn IndexRange>>

Compute the Z-index ranges that cover zbounds.
Source§

fn longest_common_prefix(values: &[u64]) -> ZPrefix

Compute the longest common binary prefix for a slice of i64s. Read more

Auto Trait Implementations§

§

impl Freeze for Z2

§

impl RefUnwindSafe for Z2

§

impl Send for Z2

§

impl Sync for Z2

§

impl Unpin for Z2

§

impl UnsafeUnpin for Z2

§

impl UnwindSafe for Z2

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.