hilbert

package
v0.0.0-...-7fba6c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2015 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package Hilbert is designed to allow consumers to find the Hilbert distance on the Hilbert curve if given a 2 dimensional coordinate. This could be useful for hashing or constructing a Hilbert R-Tree. Algorithm taken from here:

http://en.wikipedia.org/wiki/Hilbert_curve

This expects coordinates in the range [0, 0] to [MaxInt32, MaxInt32]. Using negative values for x and y will have undefinied behavior.

Benchmarks: BenchmarkEncode-8 10000000 181 ns/op BenchmarkDecode-8 10000000 191 ns/op

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(h int64) (int32, int32)

Decode will decode the provided Hilbert distance into a corresponding x and y value, respectively.

func Encode

func Encode(x, y int32) int64

Encode will encode the provided x and y coordinates into a Hilbert distance.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL