Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- destroyingAsteroids.sort((c1, c2) -> {
- if (c1.x == stationCoords.x && c1.y<stationCoords.y && c2.y>=stationCoords.y) return -1;
- if (c2.x == stationCoords.x && c2.y<stationCoords.y && c1.y>=stationCoords.y) return 1;
- if (c1.x > stationCoords.x && c2.x < stationCoords.x) return -1;
- if (c2.x > stationCoords.x && c1.x < stationCoords.x) return 1;
- var angle1 = Math.atan2(c1.x - stationCoords.x, c1.y - stationCoords.y);
- var angle2 = Math.atan2(c2.x - stationCoords.x, c2.y - stationCoords.y);
- return Double.compare(angle1, angle2);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement