Class Angle

java.lang.Object
org.apache.commons.numbers.angle.Angle
All Implemented Interfaces:
DoubleSupplier
Direct Known Subclasses:
Angle.Deg, Angle.Rad, Angle.Turn

public abstract class Angle extends Object implements DoubleSupplier
Represents the angle concept.
  • Field Details

    • TWO_PI

      public static final double TWO_PI
      2π.
      See Also:
    • PI_OVER_TWO

      public static final double PI_OVER_TWO
      π/2.
      See Also:
    • TURN_TO_DEG

      private static final double TURN_TO_DEG
      Turns to degrees conversion factor.
      See Also:
    • RAD_TO_DEG

      private static final double RAD_TO_DEG
      Radians to degrees conversion factor.
      See Also:
    • DEG_TO_RAD

      private static final double DEG_TO_RAD
      Degrees to radians conversion factor.
      See Also:
    • value

      private final double value
      Value (unit depends on concrete instance).
  • Constructor Details

    • Angle

      Angle(double value)
      Parameters:
      value - Value in turns.
  • Method Details

    • getAsDouble

      public double getAsDouble()
      Specified by:
      getAsDouble in interface DoubleSupplier
      Returns:
      the value.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Test for equality with another object. Objects are considered to be equal if their concrete types are equal and their values are exactly the same (or both are Double.NaN).
      Overrides:
      equals in class Object
      Parameters:
      other - Object to test for equality with this instance.
      Returns:
      true if the objects are equal, false if other is null, not of the same type as this instance, or not equal to this instance.
    • toTurn

      public abstract Angle.Turn toTurn()
      Convert to a Angle.Turn.
      Returns:
      the angle in turns.
    • toRad

      public abstract Angle.Rad toRad()
      Convert to a Angle.Rad.
      Returns:
      the angle in radians.
    • toDeg

      public abstract Angle.Deg toDeg()
      Convert to a Angle.Deg.
      Returns:
      the angle in degrees.