Package net.buildtheearth.terracore.geo
Enum Class CardinalDirection
- All Implemented Interfaces:
Serializable,Comparable<CardinalDirection>,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionEast, centered on 90°: azimuths in [67.5°, 112.5°).North, centered on 0°: azimuths in [337.5°, 360°) and [0°, 22.5°).Northeast, centered on 45°: azimuths in [22.5°, 67.5°).Northwest, centered on 315°: azimuths in [292.5°, 337.5°).South, centered on 180°: azimuths in [157.5°, 202.5°).Southeast, centered on 135°: azimuths in [112.5°, 157.5°).Southwest, centered on 225°: azimuths in [202.5°, 247.5°).West, centered on 270°: azimuths in [247.5°, 292.5°). -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether the given azimuth faces this cardinal direction.doubleThe end of this direction's azimuth sector in degrees, exclusive.doubleThe start of this direction's azimuth sector in degrees, inclusive.static CardinalDirectionReturns the cardinal direction closest to the given azimuth.static CardinalDirectionReturns the enum constant of this class with the specified name.static CardinalDirection[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NORTH
North, centered on 0°: azimuths in [337.5°, 360°) and [0°, 22.5°). -
NORTHEAST
Northeast, centered on 45°: azimuths in [22.5°, 67.5°). -
EAST
East, centered on 90°: azimuths in [67.5°, 112.5°). -
SOUTHEAST
Southeast, centered on 135°: azimuths in [112.5°, 157.5°). -
SOUTH
South, centered on 180°: azimuths in [157.5°, 202.5°). -
SOUTHWEST
Southwest, centered on 225°: azimuths in [202.5°, 247.5°). -
WEST
West, centered on 270°: azimuths in [247.5°, 292.5°). -
NORTHWEST
Northwest, centered on 315°: azimuths in [292.5°, 337.5°).
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
ofAzimuth
Returns the cardinal direction closest to the given azimuth.- Parameters:
angle- an azimuth, measured clockwise from north, expressed in the given unitunit- the unitangleis expressed in- Returns:
- the
CardinalDirectionthe given azimuth is the closest to - Throws:
IllegalArgumentException- if the given azimuth is not a finite numberNullPointerException- if the given unit is null
-
matches
Checks whether the given azimuth faces this cardinal direction.- Parameters:
azimuth- an azimuth measured clockwise from north; any finite value is acceptedunit- the unitazimuthis expressed in- Returns:
- true if the given azimuth faces this cardinal direction
- Throws:
IllegalArgumentException- if the given azimuth is not a finite numberNullPointerException- if the given unit is null
-
minDegrees
public double minDegrees()The start of this direction's azimuth sector in degrees, inclusive. ForNORTHthe sector wraps around 360°/0°, so this is 337.5 whilemaxDegreesis 22.5. -
maxDegrees
public double maxDegrees()The end of this direction's azimuth sector in degrees, exclusive. ForNORTHthe sector wraps around 360°/0°, so this is 22.5 whileminDegreesis 337.5.
-