Created
October 2, 2012 00:50
-
-
Save Bradsta/3815517 to your computer and use it in GitHub Desktop.
Get adjacent points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Point[] getAdjacentPoints(Point center, int length, int height) { | |
ArrayList<Point> points = new ArrayList<Point>(); | |
for (int x=(-length); x<=length; x++) { | |
for (int y=(-height); y<=height; y++) { | |
points.add(new Point(center.x + x, center.y + y)); | |
} | |
} | |
return points.toArray(new Point[points.size()]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment