Class SpatialUnits

Object
SpatialUnits

public class SpatialUnits extends Object
Units to describe spatial quantities.

These units can be specified by a string or an enum.

e.g. find a enum for nm.

e.g. find a string representation for NANO.

Acceptable string representations are: m, mm, mm^2, mm^3, nm, nm^2, nm^3, μm, μm^2, μm^3.

Author:
Owen Feehan
  • Method Details

    • suffixStringForMeters

      public static String suffixStringForMeters(SpatialUnits.UnitSuffix suffix)
      A string that describes the suffix for meters.

      e.g. m^2 or nm^3 etc.

      Parameters:
      suffix - the suffix to describe.
      Returns:
      a string describing the suffix as applied to meters.
    • convertToUnits

      public static double convertToUnits(double valueBaseUnits, String unitSuffix)
      Converts a value in base-units to another unit-type.
      Parameters:
      valueBaseUnits - the value in base units.
      unitSuffix - the suffix describing the desired unit.
      Returns:
      the value in units of type @{code unitSuffix}.
    • convertToUnits

      public static double convertToUnits(double valueBaseUnits, SpatialUnits.UnitSuffix unitSuffix)
      Converts a value in base-units to another unit-type.
      Parameters:
      valueBaseUnits - the value in base units.
      unitSuffix - the suffix describing the desired unit.
      Returns:
      the value in units of type @{code unitSuffix}.
    • convertFromUnits

      public static double convertFromUnits(double valueUnits, String unitSuffix)
      Converts a value from another unit-type to base units.
      Parameters:
      valueUnits - the value in base units.
      unitSuffix - the suffix associated with valueUnits.
      Returns:
      the value in base units.
    • convertFromUnits

      public static double convertFromUnits(double valueUnits, SpatialUnits.UnitSuffix unitSuffix)
      Converts a value from another unit-type to base units.
      Parameters:
      valueUnits - the value in base units.
      unitSuffix - the suffix associated with valueUnits.
      Returns:
      the value in base units.