Package com.geodesk.geom
Class Hilbert
java.lang.Object
com.geodesk.geom.Hilbert
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Hilbert
public Hilbert()
-
-
Method Details
-
fromXY
public static int fromXY(int x, int y) Calculates the distance of a coordinate along the Hilbert Curve. The coordinate space is technically 0 <= x/y < 2^16, but this would require treating the signed result as an unsigned value. Since this is unintuitive and leads to needless frustrations, the maximum coordinate value should be 2^15-1. Technically, this means we use a single quadrant of a 16th-order Hilbert curve (i.e. a 15th-order Hilbert curve). TODO: could we just use longs instead?- Parameters:
x
- (must be 0 <= x < 2^15)y
- (must be 0 <= y < 2^15)- Returns:
- the Hilbert Curve distance; (0 <= distance < 2^30)
-
main
-