return getCircleCoordinates(coordinate1, realm, 1).contains(coordinate2);
}
public static Vector<Coordinate> getCircleCoordinates(Coordinate coordinate, Realm realm, int distance) {
Vector<Coordinate> coordinates = new Vector<Coordinate>();
Coordinate relativeCoordinate = new Coordinate(coordinate.getAbscissa(), coordinate.getOrdinate() - 2 * distance);
coordinates.add(relativeCoordinate);
for (int i = 0; i < distance * 2; i++) {
relativeCoordinate = relativeCoordinate.getRelativeCoordinate(RealmConstants.SOUTHEAST);
relativeCoordinate.setAbscissa((relativeCoordinate.getAbscissa() + realm.getMapWidth()) % realm.getMapWidth());
if (isValidCoordinate(realm, relativeCoordinate)) {
coordinates.add(relativeCoordinate);
}
}
for (int i = 0; i < distance * 2; i++) {
relativeCoordinate = relativeCoordinate.getRelativeCoordinate(RealmConstants.SOUTHWEST);
relativeCoordinate.setAbscissa((relativeCoordinate.getAbscissa() + realm.getMapWidth()) % realm.getMapWidth());
if (isValidCoordinate(realm, relativeCoordinate)) {
coordinates.add(relativeCoordinate);
}
}
for (int i = 0; i < distance * 2; i++) {
relativeCoordinate = relativeCoordinate.getRelativeCoordinate(RealmConstants.NORTHWEST);
relativeCoordinate.setAbscissa((relativeCoordinate.getAbscissa() + realm.getMapWidth()) % realm.getMapWidth());
if (isValidCoordinate(realm, relativeCoordinate)) {
coordinates.add(relativeCoordinate);
}
}
for (int i = 0; i < distance * 2 - 1; i++) {
relativeCoordinate = relativeCoordinate.getRelativeCoordinate(RealmConstants.NORTHEAST);
relativeCoordinate.setAbscissa((relativeCoordinate.getAbscissa() + realm.getMapWidth()) % realm.getMapWidth());
if (isValidCoordinate(realm, relativeCoordinate)) {
coordinates.add(relativeCoordinate);
}
}
return coordinates;