|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.grid.PointTools
public class PointTools
Utilities for evaluating and modifying points and collections of points. Many are specific to either Cartesian or interlaced hexagonal coordinates.
| Method Summary | |
|---|---|
static HashSet<Point> |
copy(Collection<Point> locations)
Deep clone of a collection of points. |
static int |
getBound(Collection<Point> locations,
Direction dir)
Provides the furthest index in a given direction. |
static ArrayList<Point> |
getCoordinates(Point start,
Orientation... dir)
Provides the path given from a series of offsets from an original point (not including the start). |
static int |
getHeight(Collection<Point> locations)
Returns the height dimension. |
static HashSet<Point> |
getHexArea(Point center,
int radius)
Provides a hexagon shaped area with a given radius around a given location (empty if radius is less than one). |
static HashSet<Point> |
getHexBorder(Collection<Point> locations)
Provides the points surrounding given positions. |
static int |
getHexDistance(Point p1,
Point p2)
Provides the shortest distance between two points in vertically-aligned interlaced hexagonal coordinates. |
static ArrayList<HexDirection> |
getHexPath(Point p1,
Point p2,
boolean route)
Provides the the shortest directions from one point to another. |
static HashSet<Point> |
getHexReverse(Set<Point> locations,
Point pivot)
Constructs a set of points with a mirror reversal about all axes along the pivot point. |
static ArrayList<Point> |
getHexRotateCCW(Collection<Point> locations,
Point pivot)
Constructs a set with the points rotated counterclockwise about the pivot. |
static ArrayList<Point> |
getHexRotateCW(Collection<Point> locations,
Point pivot)
Constructs a set with the points rotated clockwise about the pivot. |
static HashMap<HexDirection,ArrayList<Point>> |
getHexRotations(Collection<Point> locations,
Point pivot,
HexDirection patternDir)
Constructs all rotations for a collection of locations around a pivot point. |
static HashSet<Point> |
getQuadArea(Point center,
int radius)
Provides a diamond shaped pattern centered around a given location (empty if radius is less than one). |
static HashSet<Point> |
getQuadBorder(Collection<Point> locations,
boolean diagonals)
Provides the locations surrounding a set of positions. |
static int |
getQuadDistance(Point p1,
Point p2)
Provides the shortest distance between two points in Cartesian coordinates. |
static int |
getQuadDistance(Point p1,
Point p2,
boolean diagonals)
Provides the shortest distance between two points. |
static ArrayList<Orientation> |
getQuadPath(Point p1,
Point p2,
boolean diagonal,
boolean route)
Provides the the shortest directions from one point to another. |
static Point |
getQuadPivot(Collection<Point> locations,
Direction orientation)
Provides the central location within a collection of points for standard cartesian rotations. |
static HashSet<Point> |
getQuadReverse(Set<Point> locations,
Point pivot)
Constructs a set of points with a mirror reversal about both axes along the pivot point. |
static ArrayList<Point> |
getQuadRotateCCW(Collection<Point> locations,
Point pivot)
Constructs a set with the points rotated counterclockwise about the pivot. |
static ArrayList<Point> |
getQuadRotateCW(Collection<Point> locations,
Point pivot)
Constructs a set with the points rotated clockwise about the pivot. |
static int |
getWidth(Collection<Point> locations)
Returns the width dimension. |
static HashSet<Point> |
wrapper(Point location)
Constructs a collection wrapper for a single point. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static HashSet<Point> copy(Collection<Point> locations)
locations - locations to be copied
public static HashSet<Point> wrapper(Point location)
location - contents of the wrapper
public static int getBound(Collection<Point> locations,
Direction dir)
locations - locations to be checkeddir - direction of the side
IllegalArgumentException - if no points are providedpublic static int getWidth(Collection<Point> locations)
locations - locations to be checked
public static int getHeight(Collection<Point> locations)
locations - locations to be checked
public static ArrayList<Point> getCoordinates(Point start,
Orientation... dir)
start - location from which to start the pathdir - orientation components of the steps in the path
public static int getQuadDistance(Point p1,
Point p2)
p1 - location to be evaluatedp2 - location to be evaluated
public static int getQuadDistance(Point p1,
Point p2,
boolean diagonals)
p1 - location to be evaluatedp2 - location to be evaluateddiagonals - if distance can include diagonals
public static int getHexDistance(Point p1,
Point p2)
p1 - location to be evaluatedp2 - location to be evaluated
public static HashSet<Point> getQuadArea(Point center,
int radius)
center - central position in the diamondradius - distance that the diamond reaches from the center
public static HashSet<Point> getHexArea(Point center,
int radius)
center - central position in the hexagonal arearadius - distance that the hexagonal area reaches from the center
public static HashSet<Point> getQuadBorder(Collection<Point> locations,
boolean diagonals)
locations - positions to be checkeddiagonals - includes bordering diagonals if true, excluded otherwise
public static HashSet<Point> getHexBorder(Collection<Point> locations)
locations - positions to be checked
public static Point getQuadPivot(Collection<Point> locations,
Direction orientation)
locations - locations to be checkedorientation - forward direction of the collection (for rounding)
public static ArrayList<Point> getQuadRotateCW(Collection<Point> locations,
Point pivot)
locations - locations to be turnedpivot - central point about which to turn
public static ArrayList<Point> getQuadRotateCCW(Collection<Point> locations,
Point pivot)
locations - locations to be turnedpivot - central point about which to turn
public static ArrayList<Point> getHexRotateCW(Collection<Point> locations,
Point pivot)
locations - locations to be turnedpivot - central point about which to turn
public static ArrayList<Point> getHexRotateCCW(Collection<Point> locations,
Point pivot)
locations - locations to be turnedpivot - central point about which to turn
public static HashMap<HexDirection,ArrayList<Point>> getHexRotations(Collection<Point> locations,
Point pivot,
HexDirection patternDir)
locations - locations to be turnedpivot - central point about which to turnpatternDir - orientation of the provided locations
public static HashSet<Point> getQuadReverse(Set<Point> locations,
Point pivot)
locations - locations to be reversedpivot - central point about which to reverse
public static HashSet<Point> getHexReverse(Set<Point> locations,
Point pivot)
locations - locations to be reversedpivot - central point about which to reverse
public static ArrayList<Orientation> getQuadPath(Point p1,
Point p2,
boolean diagonal,
boolean route)
p1 - start of pathp2 - end of pathdiagonal - if true the path may contain diagonal componentsroute - if true the primary path is listed, otherwise the secondary path is used
public static ArrayList<HexDirection> getHexPath(Point p1,
Point p2,
boolean route)
p1 - start of pathp2 - end of pathroute - if true the primary path is listed, otherwise the secondary path is used
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||