Quantity types are structs and not classes. Updated the interface section. |
change base to default. default unit, base value. |
||
(2 intermediate revisions by 2 users not shown) | |||
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 | 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 default 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 == | ||
Line 8: | Line 8: | ||
|+ List of Quantity types | |+ List of Quantity types | ||
|- | |- | ||
! Quantity Type !! | ! Quantity Type !! Default Unit | ||
|- | |- | ||
| Acceleration || m/s² | | [[Type:Acceleration|Acceleration]] || m/s² | ||
|- | |- | ||
| Angle || radian | | [[Type:Angle|Angle]] || radian | ||
|- | |- | ||
| Current || ampere | | [[Type:Current|Current]] || ampere | ||
|- | |- | ||
| Distance || meter | | [[Type:Distance|Distance]] || meter | ||
|- | |- | ||
| Mass || gram | | [[Type:Mass|Mass]] || gram | ||
|- | |- | ||
| Ratio || (no unit) | | [[Type:Ratio|Ratio]] || ''(no unit)'' | ||
|- | |- | ||
| Resistance || ohm | | [[Type:Resistance|Resistance]] || ohm | ||
|- | |- | ||
| Temperature || Kelvin | | [[Type:Temperature|Temperature]] || Kelvin | ||
|- | |- | ||
| Time || Second | | [[Type:Time|Time]] || Second | ||
|- | |- | ||
| Velocity || m/s | | [[Type:Velocity|Velocity]] || m/s | ||
|- | |- | ||
| Voltage || volt | | [[Type:Voltage|Voltage]] || volt | ||
|} | |} | ||
Line 39: | Line 39: | ||
! Component !! Description | ! Component !! Description | ||
|- | |- | ||
| [[ | | [[Component:FeedQuantityFieldInterface`2| <nowiki>FeedQuantityFieldInterface<Q,T></nowiki> ]] || A quantity field interface for use with the [[Data Feed]] system | ||
|- | |- | ||
| [[ | | [[Component:QuantityTextEditorParser`2| <nowiki>QuantityTextEditorParser<U,T></nowiki> ]] || Text editor for parsing and converting a Quantity value from text input | ||
|- | |- | ||
| [[ | | [[Component:QuantityTextEditorParser`1| <nowiki>QuantityTextEditorParser<U></nowiki> ]] || Text editor for parsing a Quantity value from text input | ||
|- | |- | ||
| [[ | | [[Component:QuantityTextFormatDriver`1| <nowiki>QuantityTextFormatDriver<U></nowiki>]] || Drives a formatted text form a Quantity value | ||
|} | |} | ||
Line 54: | Line 54: | ||
! ProtoFlux Node !! Description | ! ProtoFlux Node !! Description | ||
|- | |- | ||
| [[ | | [[ProtoFlux:Base Value| <nowiki>BaseValue<U></nowiki> ]] || Returns the base value of a quantity | ||
|- | |- | ||
| [[ | | [[ProtoFlux:Format Quantity| <nowiki>FormatQuantity<U></nowiki> ]] || Formats a quantity string | ||
|- | |- | ||
| [[ | | [[ProtoFlux:From Base Value| <nowiki>FromBaseValue<U></nowiki> ]] || Creates a quantity from the quantity type's base value | ||
|- | |- | ||
| [[ | | [[ProtoFlux:Parse Quantity| <nowiki>ParseQuantity<U></nowiki> ]] || Parses a quantity string | ||
|} | |} | ||
== Deprecated == | == Deprecated == | ||
The quantity interface before the [[Beta_2024.7.11.1293|type update]] was referenced as <code>QuantityX</code>. | The quantity interface before the [[Beta_2024.7.11.1293|type update]] was referenced as <code>QuantityX</code>. |
Latest revision as of 19:36, 22 February 2025
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 default 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 struct
that implements either an IQuantity<T>
or IQuantitySI<T>
interface.
Quantity Types
Quantity Type | Default 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
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
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 |
Deprecated
The quantity interface before the type update was referenced as QuantityX
.