Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public ArrayList<Location> listCircleCoordinates(PirateGame game, Location center, int radius) {
  2. int a = center.col;
  3. int b = center.row;
  4. int upperY;
  5. int lowerY;
  6. ArrayList<Location> coords = new ArrayList<Location>();
  7.  
  8. for (int i = a-radius; i<=a+radius;i++) {
  9. upperY = (int) (b + Math.sqrt((radius*radius)-(i-a)));
  10. lowerY = (int) (b - Math.sqrt((radius*radius)-(i-a)));
  11. Location loc1 = new Location(i,upperY);
  12. Location loc2 = new Location(i,lowerY);
  13. coords.add(loc1);
  14. coords.add(loc2);
  15. }
  16. return coords;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement