Dimensions

Represents a dimensional magnitude vector related to some Quantity or UnitExpression. The magnitude of each dimension is its power. For instance, the Dimensions of the UnitExpression representing "kilometers per second squared" would be: * displacement: 1 * time: -2 This data structure is extremely useful for determining if different Quantities or UnitExpressions are dimensionally compatible.

Methods

static empty() → {Dimensions}

Static method of the Dimensions constructor that returns a value that represents the "zero" of the Dimensions type.
Returns:
Dimensions

add(rhs) → {Dimensions}

Adds another Dimensions instance to this instance and returns a new Dimensions. This method is an implementation of vector addition. This operation is useful for Quantity multiplication.
Parameters:
Name Type Description
rhs Dimensions
Returns:
Dimensions

equals(rhs) → {boolean}

Returns true if the Dimensions `rhs` is equivalent to this Dimensions object; false otherwise.
Parameters:
Name Type Description
rhs Dimensions
Returns:
boolean

get(i) → {number}

Returns the magnitude (power) of the dimension in slot `i`.
Parameters:
Name Type Description
i number
Returns:
number

mult(scalar) → {Dimensions}

Multiplies this Dimensions by a scalar and returns a new Dimensions. This method is an implementation of scalar vector multiplication. This operation is useful for Quantity exponentiation.
Parameters:
Name Type Description
scalar number the scalar by which to multiply these Dimensions.
Returns:
Dimensions

size() → {number}

Returns the size of the vector.
Returns:
number