public enum Measurement extends java.lang.Enum<Measurement>
MANHATTAN
through an entire codebase when only moves in
cardinal directions are allowed, EUCLIDEAN
when you want some things to look circular instead of always
diamond-shaped as with MANHATTAN (this allows diagonal movement for pathfinders only if it is the best option), or
maybe CHEBYSHEV
if you consider using EUCLIDEAN for pathfinding (CHEBYSHEV allows cardinal and diagonal
movement with equal cost, but this permits pathfinders to make very strange choices).Enum Constant and Description |
---|
CHEBYSHEV
The distance it takes when diagonal movement costs the same as
cardinal movement.
|
EUCLIDEAN
The distance it takes as the crow flies.
|
MANHATTAN
The distance it takes when only the four primary directions can be
moved in.
|
Modifier and Type | Method and Description |
---|---|
int |
directionCount() |
double |
heuristic(Direction target) |
static Measurement |
matchingMeasurement(Radius radius)
Gets the appropriate Measurement that matches a Radius enum.
|
Radius |
matchingRadius()
Gets the appropriate Radius corresponding to a Measurement.
|
static Measurement |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Measurement[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Measurement MANHATTAN
public static final Measurement CHEBYSHEV
public static final Measurement EUCLIDEAN
public static Measurement[] values()
for (Measurement c : Measurement.values()) System.out.println(c);
public static Measurement valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic double heuristic(Direction target)
public int directionCount()
public static Measurement matchingMeasurement(Radius radius)
radius
- the Radius to find the corresponding Measurement forpublic Radius matchingRadius()
Copyright © Eben Howard 2012–2022. All rights reserved.