Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<Location> listCircleCoordinates(PirateGame game, Location center, int radius) {
- int a = center.col;
- int b = center.row;
- int upperY;
- int lowerY;
- ArrayList<Location> coords = new ArrayList<Location>();
- for (int i = a-radius; i<=a+radius;i++) {
- upperY = (int) (b + Math.sqrt((radius*radius)-(i-a)));
- lowerY = (int) (b - Math.sqrt((radius*radius)-(i-a)));
- Location loc1 = new Location(i,upperY);
- Location loc2 = new Location(i,lowerY);
- coords.add(loc1);
- coords.add(loc2);
- }
- return coords;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement