Trait lindel::Lineariseable[][src]

pub trait Lineariseable<Key> {
    fn z_index(&self) -> Key;
fn hilbert_index(&self) -> Key;
fn from_z_index(input: Key) -> Self;
fn from_hilbert_index(input: Key) -> Self; }

General trait for lineariseable data-types. Those are generally arrays, or things that behave like arrays, such as geometric points.

Required methods

fn z_index(&self) -> Key[src]

fn hilbert_index(&self) -> Key[src]

fn from_z_index(input: Key) -> Self[src]

fn from_hilbert_index(input: Key) -> Self[src]

Loading content...

Implementations on Foreign Types

impl<N, D> Lineariseable<<N as IdealKey<D>>::Key> for Point<N, D> where
    N: IdealKey<D>,
    D: DimName,
    N: Scalar + ToPrimitive + Copy + PrimInt + BitOrAssign + BitAndAssign + BitXorAssign,
    <N as IdealKey<D>>::Key: PrimInt + From<N> + BitOrAssign + BitAndAssign + ShlAssign<usize> + BitXorAssign,
    DefaultAllocator: Allocator<N, D>, 
[src]

fn z_index(&self) -> <N as IdealKey<D>>::Key[src]

The ‘Point’ analogue for the primitive types’ z_index method.

Examples

use lindel::Lineariseable;
let pnt = nalgebra::Point4::<u32>::new(51, 32, 65565, 10101010);
assert_eq!(pnt.z_index(), 4953044972870758573802201754);

fn hilbert_index(&self) -> <N as IdealKey<D>>::Key[src]

The ‘Point’ analogue for the primitive types’ hilbert_index method.

Examples

use lindel::Lineariseable;
let pnt = nalgebra::Point4::<u32>::new(51, 32, 65565, 10101010);
assert_eq!(pnt.hilbert_index(), 4961111386034627444566496746);

fn from_z_index(input: <N as IdealKey<D>>::Key) -> Self[src]

The ‘Point’ analogue for the primitive types’ z_index method.

Examples

use lindel::Lineariseable;
type Pnt = nalgebra::Point4::<u32>;
let pnt = Pnt::new(51, 32, 65565, 10101010);
let z_ind = pnt.z_index();
let pnt_again = Pnt::from_z_index(z_ind);
assert_eq!(pnt, pnt_again);

fn from_hilbert_index(input: <N as IdealKey<D>>::Key) -> Self[src]

The ‘Point’ analogue for the primitive types’ hilbert_index method.

Examples

use lindel::Lineariseable;
type Pnt = nalgebra::Point4::<u32>;
let pnt = Pnt::new(51, 32, 65565, 10101010);
let h_ind = pnt.hilbert_index();
let pnt_again = Pnt::from_hilbert_index(h_ind);
assert_eq!(pnt, pnt_again);

impl<N, const D: usize> Lineariseable<<N as IdealKey<D>>::Key> for [N; D] where
    N: IdealKey<D>,
    N: ToPrimitive + Copy + PrimInt + BitOrAssign + BitAndAssign + BitXorAssign,
    <N as IdealKey<D>>::Key: PrimInt + From<N> + BitOrAssign + BitAndAssign + ShlAssign<usize> + BitXorAssign
[src]

fn z_index(&self) -> <N as IdealKey<D>>::Key[src]

A thin wrapper around the morton_encode function.

fn hilbert_index(&self) -> <N as IdealKey<D>>::Key[src]

A function for creating the Hilbert Index of an array of primitive integers.

Examples:

assert_eq!([4u8, 5, 6].hilbert_index(), 351);

fn from_z_index(input: <N as IdealKey<D>>::Key) -> Self[src]

A thin wrapper around the morton_decode function.

fn from_hilbert_index(input: <N as IdealKey<D>>::Key) -> Self[src]

A function for decoding a Hilbert Index into an array of primitive integers.

Examples:

assert_eq!(<[u8; 4]>::from_hilbert_index(0xDEADBEEFu32), [199, 38, 136, 240]);
Loading content...

Implementors

Loading content...