Class S1Angle

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<S1Angle>

    @GwtCompatible(serializable=true)
    public final class S1Angle
    extends java.lang.Object
    implements java.lang.Comparable<S1Angle>, java.io.Serializable
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  S1Angle.Builder
      A builder of S1Angle instances.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static S1Angle INFINITY
      An angle larger than any finite angle.
      private double radians  
      static S1Angle ZERO
      An explicit shorthand for the default constructor.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        S1Angle()
      The default constructor yields a zero angle.
      private S1Angle​(double radians)  
        S1Angle​(S2Point x, S2Point y)
      Return the angle between two points, which is also equal to the distance between these points on the unit sphere.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      S1Angle add​(S1Angle a)
      Retuns an S1Angle whose angle is (this + a).
      int compareTo​(S1Angle that)  
      double cos()
      Returns the trigonometric cosine of the angle.
      double degrees()
      Returns the angle in degrees.
      static S1Angle degrees​(double degrees)
      Returns a new S1Angle converted from degrees.
      double distance​(double radius)
      Returns the distance along the surface of a sphere of the given radius.
      S1Angle div​(double d)
      Retuns an S1Angle whose angle is (this / d).
      int e5()
      Returns angle in tens of microdegrees, rounded to the nearest ten microdegrees.
      static S1Angle e5​(int e5)
      Returns a new S1Angle converted from tens of microdegrees.
      int e6()
      Returns angle in microdegrees, rounded to the nearest microdegree.
      static S1Angle e6​(int e6)
      Returns a new S1Angle converted from microdegrees.
      int e7()
      Returns angle in tenths of a microdegree, rounded to the nearest tenth of a microdegree.
      static S1Angle e7​(int e7)
      Returns a new S1Angle converted from tenths of a microdegree.
      boolean equals​(java.lang.Object that)  
      boolean greaterOrEquals​(S1Angle that)  
      boolean greaterThan​(S1Angle that)  
      int hashCode()  
      boolean lessOrEquals​(S1Angle that)  
      boolean lessThan​(S1Angle that)  
      static S1Angle max​(S1Angle left, S1Angle right)  
      static S1Angle min​(S1Angle left, S1Angle right)  
      S1Angle mul​(double m)
      Retuns an S1Angle whose angle is (this * m).
      S1Angle neg()  
      S1Angle normalize()
      Returns the angle normalized to the range (-180, 180] degrees.
      double radians()
      Returns the angle in radians.
      static S1Angle radians​(double radians)
      Returns a new S1Angle specified in radians.
      double sin()
      Returns the trigonometric sine of the angle.
      S1Angle sub​(S1Angle a)
      Retuns an S1Angle whose angle is (this - a).
      double tan()
      Returns the trigonometric tangent of the angle.
      S1Angle.Builder toBuilder()
      Creates a new Builder initialized to a copy of this angle.
      java.lang.String toString()
      Writes the angle in degrees with a "d" suffix, e.g.
      • Methods inherited from class java.lang.Object

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

      • INFINITY

        public static final S1Angle INFINITY
        An angle larger than any finite angle.
      • ZERO

        public static final S1Angle ZERO
        An explicit shorthand for the default constructor.
      • radians

        private final double radians
    • Constructor Detail

      • S1Angle

        public S1Angle()
        The default constructor yields a zero angle.
      • S1Angle

        private S1Angle​(double radians)
      • S1Angle

        public S1Angle​(S2Point x,
                       S2Point y)
        Return the angle between two points, which is also equal to the distance between these points on the unit sphere. The points do not need to be normalized.
    • Method Detail

      • radians

        public double radians()
        Returns the angle in radians.
      • degrees

        public double degrees()
        Returns the angle in degrees.
      • e5

        public int e5()
        Returns angle in tens of microdegrees, rounded to the nearest ten microdegrees.

        Normalized angles will never overflow an int.

        Throws:
        java.lang.IllegalArgumentException - if the result overflows an int
      • e6

        public int e6()
        Returns angle in microdegrees, rounded to the nearest microdegree.

        Normalized angles will never overflow an int.

        Throws:
        java.lang.IllegalArgumentException - if the result overflows an int
      • e7

        public int e7()
        Returns angle in tenths of a microdegree, rounded to the nearest tenth of a microdegree.

        Normalized angles will never overflow an int.

        Throws:
        java.lang.IllegalArgumentException - if the result overflows an int
      • equals

        public boolean equals​(java.lang.Object that)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • lessThan

        public boolean lessThan​(S1Angle that)
      • greaterThan

        public boolean greaterThan​(S1Angle that)
      • lessOrEquals

        public boolean lessOrEquals​(S1Angle that)
      • greaterOrEquals

        public boolean greaterOrEquals​(S1Angle that)
      • radians

        public static S1Angle radians​(double radians)
        Returns a new S1Angle specified in radians.
      • degrees

        public static S1Angle degrees​(double degrees)
        Returns a new S1Angle converted from degrees. Note that degrees(x).degrees() == x may not hold due to inexact arithmetic.
      • e5

        public static S1Angle e5​(int e5)
        Returns a new S1Angle converted from tens of microdegrees.
      • e6

        public static S1Angle e6​(int e6)
        Returns a new S1Angle converted from microdegrees.
      • e7

        public static S1Angle e7​(int e7)
        Returns a new S1Angle converted from tenths of a microdegree.
      • distance

        public double distance​(double radius)
        Returns the distance along the surface of a sphere of the given radius.
      • mul

        @CheckReturnValue
        public S1Angle mul​(double m)
        Retuns an S1Angle whose angle is (this * m).
      • div

        @CheckReturnValue
        public S1Angle div​(double d)
        Retuns an S1Angle whose angle is (this / d).
      • cos

        public double cos()
        Returns the trigonometric cosine of the angle.
      • sin

        public double sin()
        Returns the trigonometric sine of the angle.
      • tan

        public double tan()
        Returns the trigonometric tangent of the angle.
      • normalize

        @CheckReturnValue
        public S1Angle normalize()
        Returns the angle normalized to the range (-180, 180] degrees.
      • toString

        public java.lang.String toString()
        Writes the angle in degrees with a "d" suffix, e.g. "17.3745d". By default 6 digits are printed; this can be changed using setprecision(). Up to 17 digits are required to distinguish one angle from another.
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(S1Angle that)
        Specified by:
        compareTo in interface java.lang.Comparable<S1Angle>
      • toBuilder

        public S1Angle.Builder toBuilder()
        Creates a new Builder initialized to a copy of this angle.