Enum EPrimaryIntercardinalDirection2D

    • Method Detail

      • values

        public static EPrimaryIntercardinalDirection2D[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (EPrimaryIntercardinalDirection2D c : EPrimaryIntercardinalDirection2D.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static EPrimaryIntercardinalDirection2D valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null
      • angleDegrees

        public int angleDegrees()
        Gets the angle of this direction in degrees, where 0 degrees is north, 90 degrees is east, 180 degrees is south, and 270 degrees is west.
        Returns:
        The angle in degrees.
      • angleRadians

        public double angleRadians()
        Gets the angle of this direction in radians, where 0 radians is north, π/2 radians is east, π radians is south, and 3π/2 radians is west.
        Returns:
        The angle in radians.
      • rotate45Left

        public ECardinalDirection2D rotate45Left()
        Rotates this direction 45 degrees to the left.
        Returns:
        The direction rotated 45 degrees to the left.
      • rotate45Right

        public ECardinalDirection2D rotate45Right()
        Rotates this direction 45 degrees to the right.
        Returns:
        The direction rotated 45 degrees to the right.
      • rotate90Left

        public EPrimaryIntercardinalDirection2D rotate90Left()
        Rotates this direction 90 degrees to the left.
        Returns:
        The direction rotated 90 degrees to the left.
      • rotate90Right

        public EPrimaryIntercardinalDirection2D rotate90Right()
        Rotates this direction 90 degrees to the right.
        Returns:
        The direction rotated 90 degrees to the right.
      • between

        public static EPrimaryIntercardinalDirection2D between​(ECardinalDirection2D first,
                                                               ECardinalDirection2D second)
        Calculates the primary intercardinal direction that is between the two specified cardinal directions. For example, if NORTH and EAST are given, returns NORTH_EAST.

        If the two cardinal directions are not adjacent (same or opposite), the return value is defined as follows: take the angle of both cardinal direction and take the smaller of the two angles. Start at that angle and move counter-clockwise, taking the first primary intercardinal direction that is encountered.

        Parameters:
        first - The first cardinal direction.
        second - The second cardinal direction.
        Returns:
        The primary intercardinal direction between the two specified cardinal directions.
      • intercardinalDirection2DBetween

        public static EPrimaryIntercardinalDirection2D intercardinalDirection2DBetween​(ECardinalDirection2D first,
                                                                                       ECardinalDirection2D second)
        Calculates the primary intercardinal direction that is between the two specified cardinal directions. For example, if NORTH and EAST are given, returns NORTH_EAST.

        If the two cardinal directions are not adjacent (same or opposite), the return value is defined as follows: take the angle of both cardinal direction and take the smaller of the two angles. Start at that angle and move counter-clockwise, taking the first primary intercardinal direction that is encountered.

        Parameters:
        first - The first cardinal direction.
        second - The second cardinal direction.
        Returns:
        The primary intercardinal direction between the two specified cardinal directions.
      • ofAngleDegrees

        public static EPrimaryIntercardinalDirection2D ofAngleDegrees​(long angleDegrees)
        Calculates the primary intercardinal direction that is closest to the specified angle in degrees, defined as follows in terms of the angle when normalized to the range [0, 360):
        Parameters:
        angleDegrees - The angle in degrees.
        Returns:
        The primary intercardinal direction corresponding to the specified angle.
      • ofAngleDegrees

        public static EPrimaryIntercardinalDirection2D ofAngleDegrees​(double angleDegrees)
        Calculates the primary intercardinal direction that is closest to the specified angle in degrees, defined as follows in terms of the angle when normalized to the range [0, 360):
        Parameters:
        angleDegrees - The angle in degrees.
        Returns:
        The primary intercardinal direction corresponding to the specified angle.
      • ofAngleRadians

        public static EPrimaryIntercardinalDirection2D ofAngleRadians​(double angleRadians)
        Calculates the primary intercardinal direction that is closest to the specified angle in radians, defined as follows in terms of the angle when normalized to the range [0, 2π):
        Parameters:
        angleRadians - The angle in radians.
        Returns:
        The primary intercardinal direction corresponding to the specified angle.