[][src]Crate hilbert

The Hilbert module contains these sub-modules:

  • normalize - To prepare data for transformation.
  • permutation - To reorder point coordinates as a means of generating alternate Hilbert curves.
  • point_list - Prepare points from i32 or f64 data, deriving and applying a consistent transform to each.
  • point - Represents an N-dimensional point suitable to be transformed and sorted by the Hilbert Curve.
  • transform - Performs the core Hilbert Curve transform and its inverse.


pub use self::normalize::IntegerDataRange;
pub use self::normalize::FloatDataRange;
pub use self::permutation::Permutation;
pub use self::point::Point;
pub use self::point_list::make_points_f64;
pub use self::point_list::make_points_i32;
pub use self::transform::fast_hilbert;



The normalize module contains IntegerDataRange and FloatDataRange. These structs are used to normalize point coordinates to prepare them for the Hilbert transform.


The permutation module contains the Permutation struct, which is used to reorder the coordinates in one or more Points in a consistent way. This permits the generation of multiple Hilbert Curves, each rendering the points in a different order. With multiple curves, you can improve the accuracy of K-Nearest Nighbor searches and clustering algorithms.


The point module defines the Point struct, which represents an N-dimensional point. These Points are suitable for the Hilbert Transformation, because they do not have negative values and the total number of bits required to represent each coordinate is controlled by the construction process.


The point_list module can convert point-like data in forms defined by the caller into Point structs. It defines the functions make_points_i32 and make_points_f64. They can detect the range of values in the input data and the number of bits required to code those values without losing precision, then translate and scale those values in the process of creating Points. Points created in this way are guaranteed to be acceptable to the Hilbert Curve transformation.


The transform module holds the functions which perform the forward and inverse Hilbert Transform. A more convenient way to prepare for and perform the forward transform is to create Points and call Point::hilbert_transform.