Package geo

Class Angular


  • public class Angular
    extends Object
    Methods for computing with angles.

    PS1 instructions: do NOT change the method signatures or specifications of these methods, but you should implement their method bodies, and you may add new public or private methods or classes if you like.

    • Method Detail

      • toDegrees

        public static double toDegrees​(Angle dmsAngle)
        Convert a degree-minutes-seconds angle to approximate signed floating-point degrees.
        Parameters:
        dmsAngle - angle in degrees-minutes-seconds
        Returns:
        degrees in dmsAngle, accurate to within less than 0.05 degrees, where angles north & east are positive and south & west are negative
      • displacement

        public static Angle displacement​(Angle begin,
                                         Angle end)
        Angular displacement from begin to end. Returns an angle with smallest absolute value, for example like this:

        Not this:

        Parameters:
        begin - starting angle, must be a valid latitude or longitude as defined in Angle
        end - ending angle, must be a valid angle measuring the same coordinate (latitude or longitude) as begin
        Returns:
        angle with a smallest absolute value, measuring the same coordinate as the inputs, that sweeps from begin to end