public class AreaUtils
extends java.lang.Object
| Constructor and Description |
|---|
AreaUtils() |
| Modifier and Type | Method and Description |
|---|---|
static OrderedMap<Coord,java.lang.Double> |
arrayToHashMap(boolean[][] map)
This takes a 2D boolean array and returns a HashMap of Coord keys to Double values, but will only use the value
1.0, and only for positions in map that have as their boolean element true.
|
static OrderedMap<Coord,java.lang.Double> |
arrayToHashMap(double[][] map)
This takes a 2D double array called map and returns a HashMap of Coord keys to Double values, and will have a key
for every position in map that is greater than 0.0, with values equal to those in map.
|
static OrderedMap<Coord,java.lang.Double> |
arrayToHashMap(double[][] map,
double cutoff)
This takes a 2D double array and returns a HashMap of Coord keys to Double values, but will only use the value
1.0, and only does this if the passed double[][] has a value at that position that is greater than cutoff.
|
static OrderedMap<Coord,java.lang.Double> |
dijkstraToHashMap(double[][] map)
This takes a DijkstraMap that has already completed a scan() and returns a HashMap of Coord keys to Double
values, and will have a key for every position that was reached in the DijkstraMap, with 1.0 as the only value.
|
static boolean |
verifyLimit(AimLimit limit,
Coord origin,
Coord end)
Checks that the given end Coord can be targeted from the given origin Coord given the directional targeting
rules specified by limit.
|
static boolean |
verifyReach(Reach reach,
Coord origin,
Coord end)
Checks that the given end Coord can be targeted from the given origin Coord given the complete targeting rules
specified by reach.
|
public static OrderedMap<Coord,java.lang.Double> arrayToHashMap(boolean[][] map)
map - width by height, commonly generated by FOV methodspublic static OrderedMap<Coord,java.lang.Double> arrayToHashMap(double[][] map)
map - width by height, commonly generated by FOV methodspublic static OrderedMap<Coord,java.lang.Double> arrayToHashMap(double[][] map, double cutoff)
map - width by height, commonly generated by FOV methodscutoff - any elements greater than this will be 1.0 in the return, anything else will be ignoredpublic static OrderedMap<Coord,java.lang.Double> dijkstraToHashMap(double[][] map)
map - a double[][] returned by a DijkstraMap running its scan()public static boolean verifyLimit(AimLimit limit, Coord origin, Coord end)
limit - an AimLimit enum that restricts valid points unless it is AimLimit.FREE or nullorigin - where the user isend - where the point we want to verify ispublic static boolean verifyReach(Reach reach, Coord origin, Coord end)
AimLimit.FREE.
Otherwise, it uses the metric, minDistance, and maxDistance from reach to calculate if end is target-able from
origin assuming an unobstructed playing field.reach - a Reach object that, if non-null, gives limits for how targeting can proceed.origin - where the user isend - where the point we want to verify isCopyright © Eben Howard 2012–2022. All rights reserved.