Class AngularUnit

    • Constructor Detail

      • AngularUnit

        public AngularUnit​(AngularUnitId unitId)
        Creates a new angular unit from an AngularUnitId value. Use this constructor to create an instance of AngularUnit representing any of the most commonly used angular units defined in the AngularUnitId enumeration.

        To use less common angular units not available in the enumeration, call the Unit.fromUnitId(int) factory method passing in a well-known ID of an angular unit.

        Parameters:
        unitId - the id of the angular unit to create
        Since:
        100.0.0
        See Also:
        Unit.fromUnitId(int)
    • Method Detail

      • getAngularUnitId

        public AngularUnitId getAngularUnitId()
        Gets the AngularUnitId value for the type of angular units represented by this instance.
        Returns:
        the angular unit ID
        Since:
        100.0.0
      • convertFrom

        public double convertFrom​(AngularUnit fromUnit,
                                  double angle)
        Converts a value from the given units to the units of this instance.
        Parameters:
        fromUnit - the units to convert the value from
        angle - the value to convert, in fromUnit units
        Returns:
        the value converted to the units represented by this instance
        Throws:
        java.lang.IllegalArgumentException - if fromUnit is null
        Since:
        100.0.0
        See Also:
        fromRadians(double)
      • convertTo

        public double convertTo​(AngularUnit toUnit,
                                double angle)
        Converts a value from the units of this instance to the given units.
        Parameters:
        toUnit - the units to convert the value to
        angle - the value to convert, in the units represented by this instance
        Returns:
        the value converted to the toUnit units
        Throws:
        java.lang.IllegalArgumentException - if toUnit is null
        Since:
        100.0.0
        See Also:
        toRadians(double)
      • fromRadians

        public double fromRadians​(double radians)
        Converts a value from radians to the units of this instance. This is a convenience method for the common task of conversion of angular measurements from radians. Use the convertFrom(AngularUnit, double) method to convert values from other angular units.
        Parameters:
        radians - the value to convert, in radians
        Returns:
        the value converted to the units represented by this instance
        Since:
        100.0.0
      • toRadians

        public double toRadians​(double angle)
        Converts a value from the units of this instance to radians. This is a convenience method for the common task of conversion of angular measurements to radians. Use the convertTo(AngularUnit, double) method to convert values to other angular units.
        Parameters:
        angle - the value to convert, in the units represented by this instance
        Returns:
        the value converted to radians
        Since:
        100.0.0