public LXXPoint getDestination(boolean newSession) { double angle = robot.getHeadingRadians() + Math.PI / 2; LXXPoint res1 = new LXXPoint(robot.getX(), robot.getY()); res1.x += sin(angle) * 85; res1.y += cos(angle) * 85; double d1 = res1.distance(robot.getBattleFieldWidth() / 2, robot.getBattleFieldHeight() / 2); angle = robot.getHeadingRadians() - Math.PI / 2; LXXPoint res2 = new LXXPoint(robot.getX(), robot.getY()); res2.x += sin(angle) * 85; res2.y += cos(angle) * 85; double d2 = res2.distance(robot.getBattleFieldWidth() / 2, robot.getBattleFieldHeight() / 2); return d1 < d2 ? res1 : res2; }