Class Morton2D

java.lang.Object
be.panako.util.Morton2D

public class Morton2D
extends java.lang.Object
Encode/decode 2D coordinates to Morton codes (Z-order curve)
Author:
eren-ck
  • Constructor Summary

    Constructors
    Constructor Description
    Morton2D()  
  • Method Summary

    Modifier and Type Method Description
    static int[] decode​(long c)
    Decode Morton (z-ordering)
    static long encode​(int x, int y)
    Morton (z-ordering) encoding with Lookup Table method

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Morton2D

      public Morton2D()
  • Method Details

    • encode

      public static long encode​(int x, int y)
      Morton (z-ordering) encoding with Lookup Table method
      Parameters:
      x - range is from 0 to 16777215 (24bits).
      y - range is from 0 to 16777215 (24bits).
      Returns:
      return Morton Code as long .
    • decode

      public static int[] decode​(long c)
      Decode Morton (z-ordering)
      Parameters:
      c - morton code up to 48 bits
      Returns:
      array [x,y] .