SHARE
TWEET

Untitled

a guest Dec 13th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         destroyingAsteroids.sort((c1, c2) -> {
  2.             if (c1.x == stationCoords.x && c1.y<stationCoords.y && c2.y>=stationCoords.y) return -1;
  3.             if (c2.x == stationCoords.x && c2.y<stationCoords.y && c1.y>=stationCoords.y) return 1;
  4.             if (c1.x > stationCoords.x && c2.x < stationCoords.x) return -1;
  5.             if (c2.x > stationCoords.x && c1.x < stationCoords.x) return 1;
  6.             var angle1 = Math.atan2(c1.x - stationCoords.x, c1.y - stationCoords.y);
  7.             var angle2 = Math.atan2(c2.x - stationCoords.x, c2.y - stationCoords.y);
  8.  
  9.             return Double.compare(angle1, angle2);
  10.         });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top