58 return new Path(
null);
63 return SIMPLE_PATH_CHECKER.check(source.
getPosition(), targetPosition, source.
width(),
false);
67 return SIMPLE_PATH_CHECKER.check(source.
getPosition(), target, source.
width(),
false);
72 return SIMPLE_PATH_CHECKER.check(source.
getPosition(), targetPosition, Math.max(1, Math.max(source.
width(), source.
length())),
true);
84 private boolean check(
Position start,
Position end,
int size,
boolean projectile) {
87 int xSignum = Integer.signum(dx);
88 int ySignum = Integer.signum(dy);
90 int nextX = start.
getX();
91 int nextY = start.
getY();
100 }
else if (nextX != end.
getX()) {
101 int pointSlope = (nextX + xSignum - start.
getX()) * dy / dx + start.
getY();
103 if (Math.abs(pointSlope - currentY) > 1) {
111 Position current =
new Position(currentX, currentY, height);
112 Position next =
new Position(nextX, nextY, height);
118 if (!projectile && !
traversable(current, next, size)) {
122 if (nextX == end.
getX() && nextY == end.
getY()) {