Class GeometryUtil
java.lang.Object
me.despical.inventoryframework.util.GeometryUtil
An utility class for Geometry
- Since:
- 1.0.1
Created at 04.09.2020
- Author:
- Despical
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int[]getBorders(int row) processClockwiseRotation(int x, int y, int length, int height, int rotation) Calculates a clockwise rotation across a two dimensional gridprocessCounterClockwiseRotation(int x, int y, int length, int height, int rotation) Calculates a counter clockwise rotation across a two dimensional grid.static int[]slotToXY(int slot) static intxyToSlot(int x, int y)
-
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 coordinatey- the standard y coordinatelength- the length of the gridheight- the height of the gridrotation- 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 callingprocessClockwiseRotation(int, int, int, int, int)with 360 - rotation as the rotation.- Parameters:
x- the standard x coordinatey- the standard y coordinatelength- the length of the gridheight- the height of the gridrotation- 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)
-