Enum Class AngleUnit

java.lang.Object
java.lang.Enum<AngleUnit>
net.buildtheearth.terracore.geo.AngleUnit
All Implemented Interfaces:
Serializable, Comparable<AngleUnit>, Constable

public enum AngleUnit extends Enum<AngleUnit>
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
    Enum Constant
    Description
    The degree unit: a full turn is 360°.
    The radian unit: a full turn is 2π radians.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    fromDegrees(double angle)
    Converts an angle given in degrees to this unit.
    float
    fromDegrees(float angle)
    Converts an angle given in degrees to this unit.
    double
    fromRadians(double angle)
    Converts an angle given in radians to this unit.
    float
    fromRadians(float angle)
    Converts an angle given in radians to this unit.
    double
    toDegrees(double angle)
    Converts an angle from this unit to degrees.
    float
    toDegrees(float angle)
    Converts an angle from this unit to degrees.
    double
    toRadians(double angle)
    Converts an angle from this unit to radians.
    float
    toRadians(float angle)
    Converts an angle from this unit to radians.
    static AngleUnit
    Returns the enum constant of this class with the specified name.
    static AngleUnit[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • RADIANS

      public static final AngleUnit RADIANS
      The radian unit: a full turn is 2π radians.
    • DEGREES

      public static final AngleUnit DEGREES
      The degree unit: a full turn is 360°.
  • Method Details

    • values

      public static AngleUnit[] 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

      public static AngleUnit valueOf(String name)
      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 name
      NullPointerException - 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 is DEGREES.
      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 is DEGREES.
      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 is RADIANS.
      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 is RADIANS.
      Parameters:
      angle - the angle in radians
      Returns:
      the angle in this unit