This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Pavlidis { | |
private Pavlidis() { throw new IllegalStateException("Cannot instantiate Pavlidis"); } | |
private static final Map<Direction, Map<DirectionalVector, Direction>> directionMap = new HashMap<>(); | |
private static final Map<Direction, Direction> rotateDirectionMap = new HashMap<>(); | |
static { | |
// This is used to determine the next relative direction when moving to a found element | |
directionMap.put(Direction.North, new HashMap<>()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void iterateAndApplyMethodBetweenTwoPoints(Vector2 pos1, Vector2 pos2, Supplier<FunctionInput> function) { | |
// If the two points are the same no need to iterate. Just run the provided function | |
if (pos1.epsilonEquals(pos2)) { | |
function.invoke(); | |
return; | |
} | |
int matrixX1 = pos1.x; | |
int matrixY1 = pos1.y; | |
int matrixX2 = pos2.x; |