Package net.buildtheearth.terracore.geo
Enum Class AngleUnit
- All Implemented Interfaces:
Serializable,Comparable<AngleUnit>,Constable
A unit to measure angles, with conversion of angles to degrees and radians.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptiondoublefromDegrees(double angle) Converts an angle given in degrees to this unit.floatfromDegrees(float angle) Converts an angle given in degrees to this unit.doublefromRadians(double angle) Converts an angle given in radians to this unit.floatfromRadians(float angle) Converts an angle given in radians to this unit.doubletoDegrees(double angle) Converts an angle from this unit to degrees.floattoDegrees(float angle) Converts an angle from this unit to degrees.doubletoRadians(double angle) Converts an angle from this unit to radians.floattoRadians(float angle) Converts an angle from this unit to radians.static AngleUnitReturns the enum constant of this class with the specified name.static AngleUnit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
RADIANS
The radian unit: a full turn is 2π radians. -
DEGREES
The degree unit: a full turn is 360°.
-
-
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
-
toDegrees
public double toDegrees(double angle) Converts an angle from this unit to degrees.
This is only guaranteed to be lossless for angles that are already in degrees.- Parameters:
angle- the angle to convert- Returns:
- the angle in degrees
-
toDegrees
public float toDegrees(float angle) Converts an angle from this unit to degrees.
This is only guaranteed to be lossless for angles that are already in degrees.- Parameters:
angle- the angle to convert- Returns:
- the angle in degrees
-
toRadians
public double toRadians(double angle) Converts an angle from this unit to radians.
This is only guaranteed to be lossless for angles that are already in radians.- Parameters:
angle- the angle to convert- Returns:
- the angle in radians
-
toRadians
public float toRadians(float angle) Converts an angle from this unit to radians.
This is only guaranteed to be lossless for angles that are already in radians.- Parameters:
angle- the angle to convert- Returns:
- the angle in radians
-
fromDegrees
public double fromDegrees(double angle) Converts an angle given in degrees to this unit.
This is only guaranteed to be lossless when this unit isDEGREES.- Parameters:
angle- the angle in degrees- Returns:
- the angle in this unit
-
fromDegrees
public float fromDegrees(float angle) Converts an angle given in degrees to this unit.
This is only guaranteed to be lossless when this unit isDEGREES.- Parameters:
angle- the angle in degrees- Returns:
- the angle in this unit
-
fromRadians
public double fromRadians(double angle) Converts an angle given in radians to this unit.
This is only guaranteed to be lossless when this unit isRADIANS.- Parameters:
angle- the angle in radians- Returns:
- the angle in this unit
-
fromRadians
public float fromRadians(float angle) Converts an angle given in radians to this unit.
This is only guaranteed to be lossless when this unit isRADIANS.- Parameters:
angle- the angle in radians- Returns:
- the angle in this unit
-