public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix)
        {
            double value  = As(unit);
            string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix);

            return(ToString(unit, provider, format));
        }
Esempio n. 2
0
        private double AsBaseNumericType(RotationalStiffnessUnit unit)
        {
            if (Unit == unit)
            {
                return(_value);
            }

            var baseUnitValue = AsBaseUnit();

            switch (unit)
            {
            case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return((baseUnitValue) / 1e3d);

            case RotationalStiffnessUnit.KilopoundForceFootPerDegrees: return(baseUnitValue / 77682.6);

            case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return((baseUnitValue) / 1e6d);

            case RotationalStiffnessUnit.NewtonMeterPerRadian: return(baseUnitValue);

            case RotationalStiffnessUnit.PoundForceFootPerDegrees: return(baseUnitValue / 77.6826);

            default:
                throw new NotImplementedException($"Can not convert {Unit} to {unit}.");
            }
        }
        public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] string cultureName)
        {
            // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
            IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName);

            return(UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit));
        }
        // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx
#if !WINDOWS_UWP
        /// <summary>
        ///     Dynamically convert from value and unit enum <see cref="RotationalStiffnessUnit" /> to <see cref="RotationalStiffness" />.
        /// </summary>
        /// <param name="value">Value to convert from.</param>
        /// <param name="fromUnit">Unit to convert from.</param>
        /// <returns>RotationalStiffness unit value.</returns>
        public static RotationalStiffness?From(QuantityValue?value, RotationalStiffnessUnit fromUnit)
        {
            if (!value.HasValue)
            {
                return(null);
            }

            return(new RotationalStiffness((double)value.Value, fromUnit));
        }
Esempio n. 5
0
        /// <summary>
        ///     Creates the quantity with the given numeric value and unit.
        /// </summary>
        /// <param name="value">The numeric value to construct this quantity with.</param>
        /// <param name="unit">The unit representation to construct this quantity with.</param>
        /// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
        /// <exception cref="ArgumentException">If value is NaN or Infinity.</exception>
        private RotationalStiffness(double value, RotationalStiffnessUnit unit)
        {
            if (unit == RotationalStiffnessUnit.Undefined)
            {
                throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
            }

            _value = Guard.EnsureValidNumber(value, nameof(value));
            _unit  = unit;
        }
        private double AsBaseNumericType(RotationalStiffnessUnit unit)
        {
            if (Unit == unit)
            {
                return(_value);
            }

            var baseUnitValue = AsBaseUnit();

            switch (unit)
            {
            case RotationalStiffnessUnit.CentinewtonMeterPerRadian: return((baseUnitValue) / 1e-2d);

            case RotationalStiffnessUnit.DecanewtonMeterPerRadian: return((baseUnitValue) / 1e1d);

            case RotationalStiffnessUnit.DecinewtonMeterPerRadian: return((baseUnitValue) / 1e-1d);

            case RotationalStiffnessUnit.ExanewtonMeterPerRadian: return((baseUnitValue) / 1e18d);

            case RotationalStiffnessUnit.FemtonewtonMeterPerRadian: return((baseUnitValue) / 1e-15d);

            case RotationalStiffnessUnit.GiganewtonMeterPerRadian: return((baseUnitValue) / 1e9d);

            case RotationalStiffnessUnit.HectonewtonMeterPerRadian: return((baseUnitValue) / 1e2d);

            case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return((baseUnitValue) / 1e3d);

            case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return((baseUnitValue) / 1e6d);

            case RotationalStiffnessUnit.MicronewtonMeterPerRadian: return((baseUnitValue) / 1e-6d);

            case RotationalStiffnessUnit.MillinewtonMeterPerRadian: return((baseUnitValue) / 1e-3d);

            case RotationalStiffnessUnit.NanonewtonMeterPerRadian: return((baseUnitValue) / 1e-9d);

            case RotationalStiffnessUnit.NewtonMeterPerRadian: return(baseUnitValue);

            case RotationalStiffnessUnit.PetanewtonMeterPerRadian: return((baseUnitValue) / 1e15d);

            case RotationalStiffnessUnit.PiconewtonMeterPerRadian: return((baseUnitValue) / 1e-12d);

            case RotationalStiffnessUnit.QutranewtonMeterPerRadian: return((baseUnitValue) / 1e27d);

            case RotationalStiffnessUnit.TeranewtonMeterPerRadian: return((baseUnitValue) / 1e12d);

            case RotationalStiffnessUnit.VettanewtonMeterPerRadian: return((baseUnitValue) / 1e30d);

            case RotationalStiffnessUnit.YottanewtonMeterPerRadian: return((baseUnitValue) / 1e24d);

            case RotationalStiffnessUnit.ZettanewtonMeterPerRadian: return((baseUnitValue) / 1e21d);

            default:
                throw new NotImplementedException($"Can not convert {Unit} to {unit}.");
            }
        }
Esempio n. 7
0
        /// <summary>
        ///     Convert to the unit representation <paramref name="unit" />.
        /// </summary>
        /// <returns>Value converted to the specified unit.</returns>
        public double As(RotationalStiffnessUnit unit)
        {
            if (Unit == unit)
            {
                return(Convert.ToDouble(Value));
            }

            var converted = AsBaseNumericType(unit);

            return(Convert.ToDouble(converted));
        }
Esempio n. 8
0
        /// <summary>
        ///     Convert to the unit representation <paramref name="unit" />.
        /// </summary>
        /// <returns>Value in new unit if successful, exception otherwise.</returns>
        /// <exception cref="NotImplementedException">If conversion was not successful.</exception>
        public double As(RotationalStiffnessUnit unit)
        {
            switch (unit)
            {
            case RotationalStiffnessUnit.KilonewtonMeterPerRadian:
                return(KilonewtonMetersPerRadian);

            case RotationalStiffnessUnit.MeganewtonMeterPerRadian:
                return(MeganewtonMetersPerRadian);

            case RotationalStiffnessUnit.NewtonMeterPerRadian:
                return(NewtonMetersPerRadian);

            default:
                throw new NotImplementedException("unit: " + unit);
            }
        }
        /// <summary>
        ///     Parse a string with one or two quantities of the format "&lt;quantity&gt; &lt;unit&gt;".
        /// </summary>
        /// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
        /// <param name="provider">Format to use when parsing number and unit. Defaults to <see cref="UnitSystem.DefaultCulture" />.</param>
        /// <example>
        ///     Length.Parse("5.5 m", new CultureInfo("en-US"));
        /// </example>
        /// <exception cref="ArgumentNullException">The value of 'str' cannot be null. </exception>
        /// <exception cref="ArgumentException">
        ///     Expected string to have one or two pairs of quantity and unit in the format
        ///     "&lt;quantity&gt; &lt;unit&gt;". Eg. "5.5 m" or "1ft 2in"
        /// </exception>
        /// <exception cref="AmbiguousUnitParseException">
        ///     More than one unit is represented by the specified unit abbreviation.
        ///     Example: Volume.Parse("1 cup") will throw, because it can refer to any of
        ///     <see cref="VolumeUnit.MetricCup" />, <see cref="VolumeUnit.UsLegalCup" /> and <see cref="VolumeUnit.UsCustomaryCup" />.
        /// </exception>
        /// <exception cref="UnitsNetException">
        ///     If anything else goes wrong, typically due to a bug or unhandled case.
        ///     We wrap exceptions in <see cref="UnitsNetException" /> to allow you to distinguish
        ///     Units.NET exceptions from other exceptions.
        /// </exception>
        public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider provider)
        {
            if (str == null)
            {
                throw new ArgumentNullException(nameof(str));
            }

            provider = provider ?? UnitSystem.DefaultCulture;

            return(QuantityParser.Parse <RotationalStiffness, RotationalStiffnessUnit>(str, provider,
                                                                                       delegate(string value, string unit, IFormatProvider formatProvider2)
            {
                double parsedValue = double.Parse(value, formatProvider2);
                RotationalStiffnessUnit parsedUnit = ParseUnit(unit, formatProvider2);
                return From(parsedValue, parsedUnit);
            }, (x, y) => FromNewtonMetersPerRadian(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian)));
        }
Esempio n. 10
0
        public static RotationalStiffness From(QuantityValue value, RotationalStiffnessUnit fromUnit)
#endif
        {
            switch (fromUnit)
            {
            case RotationalStiffnessUnit.KilonewtonMeterPerRadian:
                return(FromKilonewtonMetersPerRadian(value));

            case RotationalStiffnessUnit.MeganewtonMeterPerRadian:
                return(FromMeganewtonMetersPerRadian(value));

            case RotationalStiffnessUnit.NewtonMeterPerRadian:
                return(FromNewtonMetersPerRadian(value));

            default:
                throw new NotImplementedException("fromUnit: " + fromUnit);
            }
        }
        /// <summary>
        ///     Parse a string with one or two quantities of the format "&lt;quantity&gt; &lt;unit&gt;".
        /// </summary>
        /// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
        /// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="UnitSystem" />'s default culture.</param>
        /// <example>
        ///     Length.Parse("5.5 m", new CultureInfo("en-US"));
        /// </example>
        /// <exception cref="ArgumentNullException">The value of 'str' cannot be null. </exception>
        /// <exception cref="ArgumentException">
        ///     Expected string to have one or two pairs of quantity and unit in the format
        ///     "&lt;quantity&gt; &lt;unit&gt;". Eg. "5.5 m" or "1ft 2in"
        /// </exception>
        /// <exception cref="AmbiguousUnitParseException">
        ///     More than one unit is represented by the specified unit abbreviation.
        ///     Example: Volume.Parse("1 cup") will throw, because it can refer to any of
        ///     <see cref="VolumeUnit.MetricCup" />, <see cref="VolumeUnit.UsLegalCup" /> and <see cref="VolumeUnit.UsCustomaryCup" />.
        /// </exception>
        /// <exception cref="UnitsNetException">
        ///     If anything else goes wrong, typically due to a bug or unhandled case.
        ///     We wrap exceptions in <see cref="UnitsNetException" /> to allow you to distinguish
        ///     Units.NET exceptions from other exceptions.
        /// </exception>
        public static RotationalStiffness Parse(string str, [CanBeNull] string cultureName)
        {
            if (str == null)
            {
                throw new ArgumentNullException(nameof(str));
            }

            // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
            IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName);

            return(QuantityParser.Parse <RotationalStiffness, RotationalStiffnessUnit>(str, provider,
                                                                                       delegate(string value, string unit, IFormatProvider formatProvider2)
            {
                double parsedValue = double.Parse(value, formatProvider2);
                RotationalStiffnessUnit parsedUnit = ParseUnit(unit, formatProvider2);
                return From(parsedValue, parsedUnit);
            }, (x, y) => FromNewtonMetersPerRadian(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian)));
        }
        public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args)
        {
            if (format == null)
            {
                throw new ArgumentNullException(nameof(format));
            }
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            provider = provider ?? UnitSystem.DefaultCulture;

            double value = As(unit);

            object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args);
            return(string.Format(provider, format, formatArgs));
        }
        public string ToString(RotationalStiffnessUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args)
        {
            if (format == null)
            {
                throw new ArgumentNullException(nameof(format));
            }
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx
            IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName);

            double value = As(unit);

            object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args);
            return(string.Format(provider, format, formatArgs));
        }
Esempio n. 14
0
        /// <summary>
        ///     Parse a string with one or two quantities of the format "&lt;quantity&gt; &lt;unit&gt;".
        /// </summary>
        /// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
        /// <param name="culture">Format to use when parsing number and unit. If it is null, it defaults to <see cref="NumberFormatInfo.CurrentInfo"/> for parsing the number and <see cref="CultureInfo.CurrentUICulture"/> for parsing the unit abbreviation by culture/language.</param>
        /// <example>
        ///     Length.Parse("5.5 m", new CultureInfo("en-US"));
        /// </example>
        /// <exception cref="ArgumentNullException">The value of 'str' cannot be null. </exception>
        /// <exception cref="ArgumentException">
        ///     Expected string to have one or two pairs of quantity and unit in the format
        ///     "&lt;quantity&gt; &lt;unit&gt;". Eg. "5.5 m" or "1ft 2in"
        /// </exception>
        /// <exception cref="AmbiguousUnitParseException">
        ///     More than one unit is represented by the specified unit abbreviation.
        ///     Example: Volume.Parse("1 cup") will throw, because it can refer to any of
        ///     <see cref="VolumeUnit.MetricCup" />, <see cref="VolumeUnit.UsLegalCup" /> and <see cref="VolumeUnit.UsCustomaryCup" />.
        /// </exception>
        /// <exception cref="UnitsNetException">
        ///     If anything else goes wrong, typically due to a bug or unhandled case.
        ///     We wrap exceptions in <see cref="UnitsNetException" /> to allow you to distinguish
        ///     Units.NET exceptions from other exceptions.
        /// </exception>
        public static RotationalStiffness Parse(string str, [CanBeNull] Culture culture)
        {
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }

            // Windows Runtime Component does not support CultureInfo type, so use culture name string for public methods instead: https://msdn.microsoft.com/en-us/library/br230301.aspx
#if WINDOWS_UWP
            IFormatProvider formatProvider = culture == null ? null : new CultureInfo(culture);
#else
            IFormatProvider formatProvider = culture;
#endif
            return(QuantityParser.Parse <RotationalStiffness, RotationalStiffnessUnit>(str, formatProvider,
                                                                                       delegate(string value, string unit, IFormatProvider formatProvider2)
            {
                double parsedValue = double.Parse(value, formatProvider2);
                RotationalStiffnessUnit parsedUnit = ParseUnit(unit, formatProvider2);
                return From(parsedValue, parsedUnit);
            }, (x, y) => FromNewtonMetersPerRadian(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian)));
        }
Esempio n. 15
0
        public string ToString(RotationalStiffnessUnit unit, [CanBeNull] Culture culture, [NotNull] string format,
                               [NotNull] params object[] args)
        {
            if (format == null)
            {
                throw new ArgumentNullException(nameof(format));
            }
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            // Windows Runtime Component does not support CultureInfo type, so use culture name string for public methods instead: https://msdn.microsoft.com/en-us/library/br230301.aspx
#if WINDOWS_UWP
            IFormatProvider formatProvider = culture == null ? null : new CultureInfo(culture);
#else
            IFormatProvider formatProvider = culture;
#endif
            double   value      = As(unit);
            object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, formatProvider, args);
            return(string.Format(formatProvider, format, formatArgs));
        }
Esempio n. 16
0
        /// <summary>
        ///     Parse a unit string.
        /// </summary>
        /// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
        /// <param name="unit">The parsed unit if successful.</param>
        /// <returns>True if successful, otherwise false.</returns>
        /// <example>
        ///     Length.TryParseUnit("m", new CultureInfo("en-US"));
        /// </example>
        /// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
        public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessUnit unit)
        {
            IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);

            return(UnitParser.Default.TryParse <RotationalStiffnessUnit>(str, provider, out unit));
        }
Esempio n. 17
0
 public static bool TryParseUnit(string str, out RotationalStiffnessUnit unit)
 {
     return(TryParseUnit(str, null, out unit));
 }
Esempio n. 18
0
 public static RotationalStiffness From(double value, RotationalStiffnessUnit fromUnit)
 {
     return(new RotationalStiffness((double)value, fromUnit));
 }
Esempio n. 19
0
        /// <summary>
        ///     Get unit abbreviation string.
        /// </summary>
        /// <param name="unit">Unit to get abbreviation for.</param>
        /// <returns>Unit abbreviation string.</returns>
        /// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
        public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] string cultureName)
        {
            IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);

            return(UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider));
        }
Esempio n. 20
0
 /// <summary>
 ///     Get unit abbreviation string.
 /// </summary>
 /// <param name="unit">Unit to get abbreviation for.</param>
 /// <returns>Unit abbreviation string.</returns>
 public static string GetAbbreviation(RotationalStiffnessUnit unit)
 {
     return(GetAbbreviation(unit, null));
 }
 /// <summary>
 ///     Get string representation of value and unit. Using two significant digits after radix.
 /// </summary>
 /// <param name="unit">Unit representation to use.</param>
 /// <param name="provider">Format to use for localization and number formatting. Defaults to <see cref="UnitSystem.DefaultCulture" />.</param>
 /// <returns>String representation.</returns>
 public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider)
 {
     return(ToString(unit, provider, 2));
 }
        public static RotationalStiffness From(QuantityValue value, RotationalStiffnessUnit fromUnit)
#endif
        {
            return(new RotationalStiffness((double)value, fromUnit));
        }
 public static RotationalStiffness From(double value, RotationalStiffnessUnit fromUnit)
 RotationalStiffness(double numericValue, RotationalStiffnessUnit unit)
 {
     _value = numericValue;
     _unit  = unit;
 }
Esempio n. 25
0
 /// <summary>
 ///     Creates the quantity with the given numeric value and unit.
 /// </summary>
 /// <param name="value">The numeric value to construct this quantity with.</param>
 /// <param name="unit">The unit representation to construct this quantity with.</param>
 /// <exception cref="ArgumentException">If value is NaN or Infinity.</exception>
 public RotationalStiffness(double value, RotationalStiffnessUnit unit)
 {
     _value = value;
     _unit  = unit;
 }
Esempio n. 26
0
        /// <summary>
        ///     Converts this Duration to another Duration with the unit representation <paramref name="unit" />.
        /// </summary>
        /// <returns>A Duration with the specified unit.</returns>
        public RotationalStiffness ToUnit(RotationalStiffnessUnit unit)
        {
            var convertedValue = GetValueAs(unit);

            return(new RotationalStiffness(convertedValue, unit));
        }
Esempio n. 27
0
        /// <summary>
        ///     Converts this RotationalStiffness to another RotationalStiffness with the unit representation <paramref name="unit" />.
        /// </summary>
        /// <returns>A RotationalStiffness with the specified unit.</returns>
        public RotationalStiffness ToUnit(RotationalStiffnessUnit unit)
        {
            var convertedValue = AsBaseNumericType(unit);

            return(new RotationalStiffness(convertedValue, unit));
        }
        public static string GetAbbreviation(
            RotationalStiffnessUnit unit,
#if WINDOWS_UWP
            [CanBeNull] string cultureName)
 /// <summary>
 ///     Dynamically convert from value and unit enum <see cref="RotationalStiffnessUnit" /> to <see cref="RotationalStiffness" />.
 /// </summary>
 /// <param name="value">Value to convert from.</param>
 /// <param name="fromUnit">Unit to convert from.</param>
 /// <returns>RotationalStiffness unit value.</returns>
 public static RotationalStiffness?From(QuantityValue?value, RotationalStiffnessUnit fromUnit)
 {
     return(value.HasValue ? new RotationalStiffness((double)value.Value, fromUnit) : default(RotationalStiffness?));
 }
Esempio n. 30
0
        private double GetValueAs(RotationalStiffnessUnit unit)
        {
            if (Unit == unit)
            {
                return(_value);
            }

            var baseUnitValue = GetValueInBaseUnit();

            switch (unit)
            {
            case RotationalStiffnessUnit.CentinewtonMeterPerDegree: return((baseUnitValue / (180 / 3.1415926535897931)) / 1e-2d);

            case RotationalStiffnessUnit.CentinewtonMillimeterPerDegree: return((baseUnitValue / 180 * 3.1415926535897931 * 1000) / 1e-2d);

            case RotationalStiffnessUnit.CentinewtonMillimeterPerRadian: return((baseUnitValue * 1000) / 1e-2d);

            case RotationalStiffnessUnit.DecanewtonMeterPerDegree: return((baseUnitValue / (180 / 3.1415926535897931)) / 1e1d);

            case RotationalStiffnessUnit.DecanewtonMillimeterPerDegree: return((baseUnitValue / 180 * 3.1415926535897931 * 1000) / 1e1d);

            case RotationalStiffnessUnit.DecanewtonMillimeterPerRadian: return((baseUnitValue * 1000) / 1e1d);

            case RotationalStiffnessUnit.DecinewtonMeterPerDegree: return((baseUnitValue / (180 / 3.1415926535897931)) / 1e-1d);

            case RotationalStiffnessUnit.DecinewtonMillimeterPerDegree: return((baseUnitValue / 180 * 3.1415926535897931 * 1000) / 1e-1d);

            case RotationalStiffnessUnit.DecinewtonMillimeterPerRadian: return((baseUnitValue * 1000) / 1e-1d);

            case RotationalStiffnessUnit.KilonewtonMeterPerDegree: return((baseUnitValue / (180 / 3.1415926535897931)) / 1e3d);

            case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return((baseUnitValue) / 1e3d);

            case RotationalStiffnessUnit.KilonewtonMillimeterPerDegree: return((baseUnitValue / 180 * 3.1415926535897931 * 1000) / 1e3d);

            case RotationalStiffnessUnit.KilonewtonMillimeterPerRadian: return((baseUnitValue * 1000) / 1e3d);

            case RotationalStiffnessUnit.KilopoundForceFootPerDegrees: return(baseUnitValue / 77682.6);

            case RotationalStiffnessUnit.MeganewtonMeterPerDegree: return((baseUnitValue / (180 / 3.1415926535897931)) / 1e6d);

            case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return((baseUnitValue) / 1e6d);

            case RotationalStiffnessUnit.MeganewtonMillimeterPerDegree: return((baseUnitValue / 180 * 3.1415926535897931 * 1000) / 1e6d);

            case RotationalStiffnessUnit.MeganewtonMillimeterPerRadian: return((baseUnitValue * 1000) / 1e6d);

            case RotationalStiffnessUnit.MicronewtonMeterPerDegree: return((baseUnitValue / (180 / 3.1415926535897931)) / 1e-6d);

            case RotationalStiffnessUnit.MicronewtonMillimeterPerDegree: return((baseUnitValue / 180 * 3.1415926535897931 * 1000) / 1e-6d);

            case RotationalStiffnessUnit.MicronewtonMillimeterPerRadian: return((baseUnitValue * 1000) / 1e-6d);

            case RotationalStiffnessUnit.MillinewtonMeterPerDegree: return((baseUnitValue / (180 / 3.1415926535897931)) / 1e-3d);

            case RotationalStiffnessUnit.MillinewtonMillimeterPerDegree: return((baseUnitValue / 180 * 3.1415926535897931 * 1000) / 1e-3d);

            case RotationalStiffnessUnit.MillinewtonMillimeterPerRadian: return((baseUnitValue * 1000) / 1e-3d);

            case RotationalStiffnessUnit.NanonewtonMeterPerDegree: return((baseUnitValue / (180 / 3.1415926535897931)) / 1e-9d);

            case RotationalStiffnessUnit.NanonewtonMillimeterPerDegree: return((baseUnitValue / 180 * 3.1415926535897931 * 1000) / 1e-9d);

            case RotationalStiffnessUnit.NanonewtonMillimeterPerRadian: return((baseUnitValue * 1000) / 1e-9d);

            case RotationalStiffnessUnit.NewtonMeterPerDegree: return(baseUnitValue / (180 / 3.1415926535897931));

            case RotationalStiffnessUnit.NewtonMeterPerRadian: return(baseUnitValue);

            case RotationalStiffnessUnit.NewtonMillimeterPerDegree: return(baseUnitValue / 180 * 3.1415926535897931 * 1000);

            case RotationalStiffnessUnit.NewtonMillimeterPerRadian: return(baseUnitValue * 1000);

            case RotationalStiffnessUnit.PoundForceFeetPerRadian: return(baseUnitValue / 1.3558179483314);

            case RotationalStiffnessUnit.PoundForceFootPerDegrees: return(baseUnitValue / 77.6826);

            default:
                throw new NotImplementedException($"Can not convert {Unit} to {unit}.");
            }
        }