Skip to content

Commit

Permalink
this is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 2, 2024
1 parent 1781da3 commit d1ee1d1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,6 @@

public class LocationUtil {

private static final int X_MASK = 0x3FFFFFF;
private static final long X_SHIFT = 38;
private static final int Y_MASK = 0xFFF;
private static final long Y_SHIFT = 26;
private static final int Y_SHIFT_UNPACK = 20;
private static final long Z_MASK = 0x3FFFFFF;
private static final int Z_SHIFT_UNPACK = 6;

public static long getLongFromCoordinates(int x, int y, int z) {
return ((long) (x & X_MASK) << X_SHIFT) | ((long) (y & Y_MASK) << Y_SHIFT) | (z & Z_MASK);
}

public static int[] getCoordinatesFromLong(long combined) {
int x = (int) (combined >> X_SHIFT);
int y = (int) ((combined >> Y_SHIFT) & Y_MASK) << Y_SHIFT_UNPACK >> Y_SHIFT_UNPACK;
int z = (int) (combined & Z_MASK) << Z_SHIFT_UNPACK >> Z_SHIFT_UNPACK;
y = (y << Y_SHIFT_UNPACK) >> Y_SHIFT_UNPACK;
z = (z << Z_SHIFT_UNPACK) >> Z_SHIFT_UNPACK;
return new int[]{x, y, z};
}

public static double getDistanceTo00(Location location) {
return FastMath.hypot(location.x(), location.z());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,6 @@

public class LocationUtil {

private static final int X_MASK = 0x3FFFFFF;
private static final long X_SHIFT = 38;
private static final int Y_MASK = 0xFFF;
private static final long Y_SHIFT = 26;
private static final int Y_SHIFT_UNPACK = 20;
private static final long Z_MASK = 0x3FFFFFF;
private static final int Z_SHIFT_UNPACK = 6;

public static long getLongFromCoordinates(int x, int y, int z) {
return ((long) (x & X_MASK) << X_SHIFT) | ((long) (y & Y_MASK) << Y_SHIFT) | (z & Z_MASK);
}

public static int[] getCoordinatesFromLong(long combined) {
int x = (int) (combined >> X_SHIFT);
int y = (int) ((combined >> Y_SHIFT) & Y_MASK) << Y_SHIFT_UNPACK >> Y_SHIFT_UNPACK;
int z = (int) (combined & Z_MASK) << Z_SHIFT_UNPACK >> Z_SHIFT_UNPACK;
y = (y << Y_SHIFT_UNPACK) >> Y_SHIFT_UNPACK;
z = (z << Z_SHIFT_UNPACK) >> Z_SHIFT_UNPACK;
return new int[]{x, y, z};
}

public static double getDistanceTo00(Location location) {
return FastMath.hypot(location.getX(), location.getZ());
}
Expand Down

0 comments on commit d1ee1d1

Please sign in to comment.