Dimensions class
The Dimensions class represents the dimensions of a physical quantity.
The Seven Base Quantities
In the International System of Units (SI) all quantities are considered to be either one of the seven base quantities (Length, Mass, Time Interval, Temperature, Current, Intensity and Amount of Substance) or derived from those base quantities through combinations and/or arbitrary exponents. The Dimensions of a quantity capture which combination applies for that particular quantity. Any combination of these base quantities is possible; in practice less than 100 derived quantities are in common use. The Dimensions of a quantity determine its type and directly relate to that quantity's significance and meaning in the real world.
The Dimensions Class Also Tracks Angle and Solid Angle
The dimensions that are tracked include the seven base SI quantities and also the angle and solid angle dimensionless quantities. Angular quantities are often distinguished from their non-angular counterparts even if the SI base dimensions are equal. Consequently, in order to support such differentiation, Angle and SolidAngle dimensions are stored alongside the base seven dimensions and used to distinguish between dimensions and determine quantity types. To test whether two Dimensions objects are equal strictly in terms of the base SI dimensions, the equalsSI method may be used.
Constructors
- Dimensions()
- No-arg constructor sets all dimensions to zero (that is, a scalar quantity).
-
Dimensions.constant(Map<
String, num> dims, {Type? qType}) -
Constructs a constant Dimensions object with a map of base dimension keys to exponents
const
- Dimensions.copy(Dimensions d2, {bool includeTypeHint = true})
- Creates a Dimensions object by copying an existing Dimensions object.
-
Dimensions.fromMap(Map<
String, num> typeValuePairs) - Constructs a Dimensions object with a map of base dimension keys to base dimension exponents.
Properties
- hashCode → int
-
Returns a hash code consistent with operator == by constructing a
string key based on the dimension component values.
no setteroverride
- isScalar → bool
-
Whether or not these are scalar dimensions, including having no angle or
solid angle dimensions.
no setter
- isScalarSI → bool
-
Whether or not these are scalar dimensions, in the strict
International System of Units (SI) sense, which allows non-zero angle and
solid angle dimensions.
no setter
- qType → Type?
-
Optional associated Quantity type
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
equalsSI(
Dimensions? d2) → bool -
Tests the equality of this Dimensions object and
d2
, only considering the seven base SI quantities (that is, angle and solid angle components are ignored). -
getComponentExponent(
String component) → num -
Gets the exponent value for the specified base dimension
component
key. -
inverse(
) → Dimensions - Determines the inverse of the dimensions represented by this object, creating a Dimension object. This object is not modified.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toQuantity(
[dynamic value = 0.0, Units? units, double uncert = 0.0]) → Quantity -
Returns an instance of the Quantity type associated with these dimensions.
If no specific Quantity type is found with dimensions that match these dimensions
an instance of the MiscQuantity class will be returned.
If no
value
is provided, it defaults to zero. If nounits
are provided, then MKS units are assumed. If no uncertainty is provided, the value is presumed to be exact. -
toString(
) → String -
Returns a String representation of this Dimensions object in the form:
override
Operators
-
operator *(
Dimensions other) → Dimensions -
Returns the product of this Dimensions object and
other
Dimensions. -
operator /(
Dimensions other) → Dimensions -
Divides this Dimension by
other
Dimensions, creating a Dimensions object. -
operator ==(
Object d2) → bool -
Tests the equality of this Dimensions object and another Dimensions object.
Two Dimensions objects are only equal if they have exactly equal
values for each component dimension.
override
-
operator ^(
num exp) → Dimensions -
Calculates these Dimensions raised to the power specified by
exp
onent
Static Methods
-
determineQuantityType(
Dimensions? dim) → Type - Determines the Quantity type associated with the specified dimensions.
Constants
- baseAmountKey → const String
- Identifier for Base SI Quantity: Amount of Substance
- baseAngleKey → const String
- Identifier for Special Derived Dimensionless SI Quantity: Angle
- baseCurrentKey → const String
- Identifier for Base SI Quantity: Current
- baseIntensityKey → const String
- Identifier for Base SI Quantity: (Luminous) Intensity
- baseLengthKey → const String
- Identifier for Base SI Quantity: Length
- baseMassKey → const String
- Identifier for Base SI Quantity: Mass
- baseSolidAngleKey → const String
- Identifier for Special Derived Dimensionless SI Quantity: Solid Angle
- baseTemperatureKey → const String
- Identifier for Base SI Quantity: Temperature
- baseTimeKey → const String
- Identifier for Base SI Quantity: Time Interval