ChangeableRelativeUnit Type

This unit refers to a reference quantity. Since the reference quantity can be changed, instances of this class are not immutable. Example: 'percent of page width': here the page width can change depending on the user defined settings.

Constructors

Constructor Description

ChangeableRelativeUnit(name, shortcut, divider, referenceQuantity)

Full Usage: ChangeableRelativeUnit(name, shortcut, divider, referenceQuantity)

Parameters:
    name : string - The full name of the unit (e.g. 'percent of page with').
    shortcut : string - The shortcut of the unit (e.g. %PW).
    divider : float - Used to calculate the relative value from the numeric value of the quantity. In the above example (percent of page width), the divider is 100.
    referenceQuantity : DimensionfulQuantity - The reference quantity.

Initializes a new instance of the ChangeableRelativeUnit class.

name : string

The full name of the unit (e.g. 'percent of page with').

shortcut : string

The shortcut of the unit (e.g. %PW).

divider : float

Used to calculate the relative value from the numeric value of the quantity. In the above example (percent of page width), the divider is 100.

referenceQuantity : DimensionfulQuantity

The reference quantity.

Instance members

Instance member Description

this.FromSIUnit

Full Usage: this.FromSIUnit

Parameters:
    x : float - Value in SI units.

Returns: float The corresponding value in this unit.
Modifiers: abstract

Converts x (in SI units) to the corresponding value in this unit.

x : float

Value in SI units.

Returns: float

The corresponding value in this unit.

this.GetRelativeValueFromValue

Full Usage: this.GetRelativeValueFromValue

Parameters:
    x : float - Numerical value to convert.

Returns: float The prefactor to multiply the ChangeableRelativeUnit.ReferenceQuantity with in order to get the absolute quantity.
Modifiers: abstract

Calculated the dimensionless prefactor to multiply the ChangeableRelativeUnit.ReferenceQuantity with. Example: Given that the relative unit is 'percent of page with', a value of x=5 is converted to 0.05. The result can then be used to calculate the absolute quantity by multiplying the result of 0.05 with the 'page with'.

x : float

Numerical value to convert.

Returns: float

The prefactor to multiply the ChangeableRelativeUnit.ReferenceQuantity with in order to get the absolute quantity.

this.Name

Full Usage: this.Name

Returns: string
Modifiers: abstract

Full name of the unit.

Returns: string

this.Prefixes

Full Usage: this.Prefixes

Returns: ISIPrefixList
Modifiers: abstract

Returns a list of possible prefixes for this unit (like ยต, m, k, M, G..).

Returns: ISIPrefixList

this.ReferenceQuantity

Full Usage: this.ReferenceQuantity

Modifiers: abstract

The corresponding quantity that this unit encapsulates.

this.SIUnit

Full Usage: this.SIUnit

Returns: SIUnit
Modifiers: abstract

Returns the corresponding SI unit.

Returns: SIUnit

this.ShortCut

Full Usage: this.ShortCut

Returns: string
Modifiers: abstract

Usual shortcut of the unit.

Returns: string

this.ToSIUnit

Full Usage: this.ToSIUnit

Parameters:
    x : float - Value to convert.

Returns: float The corresponding value of x in SI units.
Modifiers: abstract

Converts x to the corresponding SI unit.

x : float

Value to convert.

Returns: float

The corresponding value of x in SI units.