Class Angle

All Implemented Interfaces:
Atomic<Angle>, Comparable<Angle>

public final class Angle extends Primitive<Angle>
This class encapsulates radian based angles. It normalizes all angles to the range [-pi..pi).
Author:
Derk Norton
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Angle
    This constant approximates the value of pi.
  • Constructor Summary

    Constructors
    Constructor
    Description
    This default constructor creates an angle with a default value of zero radians.
    Angle​(double value)
    This constructor creates an angle with the specified value in radians.
    Angle​(String string)
    This constructor creates an angle with the specified value in radians.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Angle
    arccosine​(double ratio)
    This function returns the angle whose cosine is the specified ratio.
    static Angle
    arcsine​(double ratio)
    This function returns the angle whose sine is the specified ratio.
    static Angle
    arctangent​(double ratio)
    This function returns the angle whose tangent is the specified ratio.
    static Angle
    arctangent​(double y, double x)
    This function returns the angle whose tangent is the ratio of the specified values.
    int
    compareTo​(Angle angle)
     
    static double
    cosine​(Angle angle)
    This function returns the cosine of the specified angle.
    static Angle
    difference​(Angle angle1, Angle angle2)
    This function returns the normalized difference of two angles.
    boolean
    equals​(Object obj)
     
    int
     
    static Angle
    inverse​(Angle angle)
    This function returns the normalized inversion of the specified angle.
    static Angle
    negative​(Angle angle)
    This function returns the normalized negation of the specified angle.
    static Angle
    product​(Angle angle, double multiplier)
    This function returns the normalized product of an angle and a scalar value.
    static Angle
    quotient​(Angle angle, double divisor)
    This function returns the normalized quotient of an angle and a scalar value.
    static double
    sine​(Angle angle)
    This function returns the sine of the specified angle.
    static Angle
    sum​(Angle angle1, Angle angle2)
    This function returns the normalized sum of two angles.
    static double
    tangent​(Angle angle)
    This function returns the tangent of the specified angle.
    double
    This method returns the value of the angle as a double.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • PI

      public static final Angle PI
      This constant approximates the value of pi.
  • Constructor Details

    • Angle

      public Angle()
      This default constructor creates an angle with a default value of zero radians.
    • Angle

      public Angle(double value)
      This constructor creates an angle with the specified value in radians. If the value is outside the range (-pi..pi] then the value is normalize to be within this range.
      Parameters:
      value - The value of the new angle.
    • Angle

      public Angle(String string)
      This constructor creates an angle with the specified value in radians. If the value is outside the range (-pi..pi] then the value is normalize to be within this range.
      Parameters:
      string - The string value of the new angle.
  • Method Details

    • compareTo

      public int compareTo(Angle angle)
      Specified by:
      compareTo in interface Comparable<Angle>
      Overrides:
      compareTo in class Primitive<Angle>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Primitive<Angle>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Primitive<Angle>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toDouble

      public double toDouble()
      This method returns the value of the angle as a double.
      Returns:
      The value of the angle.
    • inverse

      public static Angle inverse(Angle angle)
      This function returns the normalized inversion of the specified angle. The value of the inverted angle is angle - pi.
      Parameters:
      angle - The angle.
      Returns:
      The inverted angle.
    • negative

      public static Angle negative(Angle angle)
      This function returns the normalized negation of the specified angle. The value of the negated angle is -angle.
      Parameters:
      angle - The angle.
      Returns:
      The negated angle.
    • sum

      public static Angle sum(Angle angle1, Angle angle2)
      This function returns the normalized sum of two angles.
      Parameters:
      angle1 - The first angle.
      angle2 - The second angle.
      Returns:
      The sum of the two angles.
    • difference

      public static Angle difference(Angle angle1, Angle angle2)
      This function returns the normalized difference of two angles.
      Parameters:
      angle1 - The first angle.
      angle2 - The second angle.
      Returns:
      The difference of the two angles.
    • product

      public static Angle product(Angle angle, double multiplier)
      This function returns the normalized product of an angle and a scalar value.
      Parameters:
      angle - The angle.
      multiplier - The scalar value.
      Returns:
      The product of the angle and scalar value.
    • quotient

      public static Angle quotient(Angle angle, double divisor)
      This function returns the normalized quotient of an angle and a scalar value.
      Parameters:
      angle - The angle.
      divisor - The scalar value.
      Returns:
      The quotient of the angle and scalar value.
    • sine

      public static double sine(Angle angle)
      This function returns the sine of the specified angle.
      Parameters:
      angle - The angle.
      Returns:
      The sine of the angle.
    • arcsine

      public static Angle arcsine(double ratio)
      This function returns the angle whose sine is the specified ratio.
      Parameters:
      ratio - The ratio of the opposite over the hypotenuse.
      Returns:
      The arcsine of the ratio.
    • cosine

      public static double cosine(Angle angle)
      This function returns the cosine of the specified angle.
      Parameters:
      angle - The angle.
      Returns:
      The cosine of the angle.
    • arccosine

      public static Angle arccosine(double ratio)
      This function returns the angle whose cosine is the specified ratio.
      Parameters:
      ratio - The ratio of the adjacent over the hypotenuse.
      Returns:
      The arccosine of the ratio.
    • tangent

      public static double tangent(Angle angle)
      This function returns the tangent of the specified angle.
      Parameters:
      angle - The angle.
      Returns:
      The tangent of the angle.
    • arctangent

      public static Angle arctangent(double ratio)
      This function returns the angle whose tangent is the specified ratio.
      Parameters:
      ratio - The ratio of the opposite over the adjacent.
      Returns:
      The arctangent of the ratio.
    • arctangent

      public static Angle arctangent(double y, double x)
      This function returns the angle whose tangent is the ratio of the specified values.
      Parameters:
      y - The y coordinate.
      x - The x coordinate.
      Returns:
      The arctangent of the ratio.