public final class SmallHilbertCurve extends Object
BigInteger
) and N-dimensional points.
Note: This algorithm is derived from work done by John Skilling and published in "Programming the Hilbert curve". (c) 2004 American Institute of Physics. With thanks also to Paul Chernoch who published a C# algorithm for Skilling's work on StackOverflow and GitHub).
Modifier and Type | Class and Description |
---|---|
static class |
SmallHilbertCurve.Builder |
Modifier and Type | Method and Description |
---|---|
long |
index(long... point)
Converts a point to its Hilbert curve index.
|
long[] |
point(long index)
Converts a
long index (distance along the Hilbert Curve from 0)
to a point of dimensions defined in the constructor of this . |
public long index(long... point)
point
- an array of long
. Each coordinate can be between 0 and
2bits-1.long
in the range 0 to 2bits *
dimensions - 1IllegalArgumentException
- if length of point array is not equal to the number of
dimensions.public long[] point(long index)
long
index (distance along the Hilbert Curve from 0)
to a point of dimensions defined in the constructor of this
.index
- index along the Hilbert Curve from 0. Maximum value 2
bits * dimensions-1.IllegalArgumentException
- if index is negativeCopyright © 2013–2017. All rights reserved.