Quantity Types: Difference between revisions

From Resonite Wiki
Another small fix
Added a deprecated section for historical reasons. Added links.
Line 1: Line 1:
To work with various quantities, Resonite provides a generic quantity system, which allows converting between various units for a given quantity type. An example of this is converting a <code>Distance</code> quantity value between metric and imperial units. There are various quantity types available, which can be used with all generic quantity nodes and components. Each quantity type has a base unit, which can be used to create a quantity value, which can then be converted between all known units of the given quantity type.
To work with various quantities, [[Resonite]] provides a generic quantity system, which allows converting between various units for a given quantity type. An example of this is converting a <code>Distance</code> quantity value between metric and imperial units. There are various quantity types available, which can be used with all generic quantity nodes and components. Each quantity type has a base unit, which can be used to create a quantity value, which can then be converted between all known units of the given quantity type.


== Technical ==
== Technical ==
The quantity system is part of the <code>Elements.Quantity</code> assembly. Every quantity type is a class implementing <code>IQuantity</code> and <code><nowiki>IQuantity<T></nowiki></code> interfaces.
The quantity system is part of the <code>Elements.Quantity</code> assembly. Every quantity type is a class implementing <code>IQuantity</code> and <code><nowiki>IQuantity<T></nowiki></code> interfaces.


=== Deprecated ===
The quantity interface before the [[Beta_2024.7.11.1293|type update]] was referenced as <code>QuantityX</code>.


== Quantity Types ==
== Quantity Types ==

Revision as of 09:40, 11 September 2024

To work with various quantities, Resonite provides a generic quantity system, which allows converting between various units for a given quantity type. An example of this is converting a Distance quantity value between metric and imperial units. There are various quantity types available, which can be used with all generic quantity nodes and components. Each quantity type has a base unit, which can be used to create a quantity value, which can then be converted between all known units of the given quantity type.

Technical

The quantity system is part of the Elements.Quantity assembly. Every quantity type is a class implementing IQuantity and IQuantity<T> interfaces.

Deprecated

The quantity interface before the type update was referenced as QuantityX.

Quantity Types

List of Quantity types
Quantity Type Base Unit
Acceleration m/s²
Angle radian
Current ampere
Distance meter
Mass gram
Ratio (no unit)
Resistance ohm
Temperature Kelvin
Time Second
Velocity m/s
Voltage volt

Quantity Components

List of components with generic quantity type parameters
Component Description
FeedQuantityFieldInterface<Q,T> A quantity field interface for use with the Data Feed system
QuantityTextEditorParser<U,T> Text editor for parsing and converting a Quantity value from text input
QuantityTextEditorParser<U> Text editor for parsing a Quantity value from text input
QuantityTextFormatDriver<U> Drives a formatted text form a Quantity value

Quantity ProtoFlux Nodes

List of ProtoFlux nodes with generic quantity type parameters
ProtoFlux Node Description
BaseValue<U> Returns the base value of a quantity
FormatQuantity<U> Formats a quantity string
FromBaseValue<U> Creates a quantity from the quantity type's base value
ParseQuantity<U> Parses a quantity string