Description

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

Copyright 2014 Workiva, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

hilbert is referenced in 1 repository

github.com/Workiva/go-datastructures