Class GeometryUtil

java.lang.Object
me.despical.inventoryframework.util.GeometryUtil

public class GeometryUtil extends Object
An utility class for Geometry
Since:
1.0.1

Created at 04.09.2020

Author:
Despical
  • Constructor Details

    • GeometryUtil

      public GeometryUtil()
  • Method Details

    • processClockwiseRotation

      @NotNull @Contract(pure=true) public static Map.Entry<Integer,Integer> processClockwiseRotation(int x, int y, int length, int height, int rotation)
      Calculates a clockwise rotation across a two dimensional grid
      Parameters:
      x - the standard x coordinate
      y - the standard y coordinate
      length - the length of the grid
      height - the height of the grid
      rotation - the rotation in degrees
      Returns:
      a pair of new coordinates, with the x coordinate being the key and the y coordinate being the value
    • processCounterClockwiseRotation

      @NotNull @Contract(pure=true) public static Map.Entry<Integer,Integer> processCounterClockwiseRotation(int x, int y, int length, int height, int rotation)
      Calculates a counter clockwise rotation across a two dimensional grid. This is the same as calling processClockwiseRotation(int, int, int, int, int) with 360 - rotation as the rotation.
      Parameters:
      x - the standard x coordinate
      y - the standard y coordinate
      length - the length of the grid
      height - the height of the grid
      rotation - the rotation in degrees
      Returns:
      a pair of new coordinates, with the x coordinate being the key and the y coordinate being the value
    • xyToSlot

      @Contract(pure=true) public static int xyToSlot(int x, int y)
    • slotToXY

      @Contract(pure=true) public static int[] slotToXY(int slot)
    • getBorders

      @Contract(pure=true) public static int[] getBorders(int row)