![]() |
NDEVR
API Documentation
|
A unit that has both a scale and an offset (think degrees celcius vs fahrenheit). More...
Public Member Functions | |
| ScaledOffsetUnit (StringView name, TranslatedString translated_id, TranslatedString abbreviation, fltp08 scale, fltp08 offset) | |
| Constructs a ScaledOffsetUnit with the given scale, offset, and abbreviation. | |
| virtual const TranslatedString & | abbreviation (uint01 direction=X) const override |
| Returns the translated abbreviation for this unit. | |
| virtual Unit * | clone (const StringView &new_name, const TranslatedString &new_display_name) const override |
| Creates a copy of this unit with a new name and display name. | |
| virtual fltp08 | convertFromUnit (const fltp08 &program_space, const uint01 direction=X) const override |
| Converts a scalar from this unit back to program space by reversing scale and offset. | |
| virtual Ray< 3, fltp08 > | convertFromUnit (const Ray< 3, fltp08 > &program_space) const override |
| Converts a 3D ray from this unit back to program space. | |
| virtual Vertex< 3, fltp08 > | convertFromUnit (const Vertex< 3, fltp08 > &program_space) const override |
| Converts a 3D vertex from this unit back to program space. | |
| virtual fltp08 | convertToUnit (const fltp08 &program_space, const uint01 direction=X) const override |
| Converts a scalar from program space to this unit using scale and offset. | |
| virtual Ray< 3, fltp08 > | convertToUnit (const Ray< 3, fltp08 > &program_space) const override |
| Converts a 3D ray from program space to this unit using scale and offset. | |
| virtual Vertex< 3, fltp08 > | convertToUnit (const Vertex< 3, fltp08 > &program_space) const override |
| Converts a 3D vertex from program space to this unit using scale and offset. | |
| virtual Matrix< fltp08 > | matrix () const override |
| Returns the transformation matrix representing this unit's scale. | |
| virtual const Unit * | subUnit (uint01) const override |
| Returns the sub-unit for the given axis direction. | |
| Public Member Functions inherited from Unit | |
| Unit (StringView name, TranslatedString translated_id) | |
| Constructs a Unit with the given internal name and translated display name. | |
| virtual | ~Unit ()=default |
| Virtual destructor. | |
| virtual Unit * | clone () const |
| Creates a deep copy of this unit. | |
| template<class t_angle_type> | |
| Angle< t_angle_type > | convertAngleFromUnit (const fltp08 &unit_space, uint01 direction=X) const |
| Converts a scalar value in this unit's space back to an Angle in program space. | |
| virtual fltp08 | convertFromString (const StringView &unit_string, uint01 direction=X) const |
| Parses a string in this unit's format and converts the result to internal program space. | |
| template<class t_angle_type> | |
| String | convertToString (const Angle< t_angle_type > &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const |
| Converts an angle value from program space to a formatted string in this unit. | |
| virtual String | convertToString (const fltp08 &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const |
| Converts a scalar value from program space to a formatted string in this unit. | |
| template<class t_angle_type> | |
| fltp08 | convertToUnit (const Angle< t_angle_type > &program_space, uint01 direction=X) const |
| Converts an angle value from program space to this unit's scalar representation. | |
| virtual fltp08 | epsilon (fltp08 value, uint01 direction=X) const |
| Returns a small epsilon value appropriate for comparisons in this unit at the given magnitude. | |
| virtual fltp08 | fromString (const StringView &unit_string, uint01 direction=X) const |
| Parses a string into a scalar value in this unit's space without converting to program space. | |
| virtual StringView | getNextPreferredSeparator (const StringView ¤t_string, uint01 direction=X) const |
| Returns the next preferred separator character sequence based on the current input string. | |
| bool | operator== (const Unit &other) const |
| Checks equality between two units by comparing their matrices and names. | |
| virtual void | toFormula (StringAllocatingView &unit_string, uint01 direction=X) const |
| Writes the unit conversion as a formula into the given string. | |
| String | toString (const fltp08 &unit_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const |
| Formats a value already in this unit's space into a display string. | |
| virtual void | toString (String &string, const fltp08 &unit_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const |
| Appends a formatted unit value to an existing string. | |
| virtual TranslatedString | translatedAxisName (uint04 index) const |
| Returns the translated axis name for a given axis index. | |
| TranslatedString | translatedName () const |
| Returns the translated display name of this unit. | |
Public Attributes | |
| const TranslatedString | core_abbreviation |
| The translated abbreviation displayed for this unit. | |
| const fltp08 | offset |
| The additive offset applied after scaling during conversion. | |
| const fltp08 | scale |
| The multiplicative scale factor for conversion. | |
| Public Attributes inherited from Unit | |
| TranslatedString | axis_abbreviations [4] |
| Translated axis abbreviations for up to four axes. | |
| TranslatedString | axis_name_ids [4] |
| Translated axis names for up to four axes. | |
| const String | name |
| Internal identifier name for this unit. | |
| const TranslatedString | translated_id |
| Translated display name for this unit. | |
Additional Inherited Members | |
| Static Protected Member Functions inherited from Unit | |
| static Buffer< StringView > | OperatorSplit (const StringView &string) |
| Splits a string by operator characters for formula parsing. | |
A unit that has both a scale and an offset (think degrees celcius vs fahrenheit).
Definition at line 410 of file UnitTypes.h.
|
inline |
Constructs a ScaledOffsetUnit with the given scale, offset, and abbreviation.
| [in] | name | The internal identifier for this unit. |
| [in] | translated_id | The translated display name for this unit. |
| [in] | abbreviation | The translated abbreviation for this unit. |
| [in] | scale | The multiplicative scale factor. |
| [in] | offset | The additive offset applied after scaling. |
Definition at line 424 of file UnitTypes.h.
References Unit::Unit(), abbreviation(), core_abbreviation, Unit::name, offset, scale, and Unit::translated_id.
Referenced by clone().
|
inlinenodiscardoverridevirtual |
Returns the translated abbreviation for this unit.
| [in] | direction | The axis direction. |
Implements Unit.
Definition at line 502 of file UnitTypes.h.
References core_abbreviation.
Referenced by ScaledOffsetUnit(), and clone().
|
inlinenodiscardoverridevirtual |
Creates a copy of this unit with a new name and display name.
| [in] | new_name | The internal identifier for the cloned unit. |
| [in] | new_display_name | The translated display name for the cloned unit. |
Implements Unit.
Definition at line 533 of file UnitTypes.h.
References ScaledOffsetUnit(), Unit::Unit(), abbreviation(), Unit::axis_abbreviations, Unit::axis_name_ids, offset, and scale.
|
inlinenodiscardoverridevirtual |
Converts a scalar from this unit back to program space by reversing scale and offset.
| [in] | program_space | The value in this unit's space. |
| [in] | direction | The axis direction for the conversion. |
Implements Unit.
Definition at line 450 of file UnitTypes.h.
|
inlinenodiscardoverridevirtual |
Converts a 3D ray from this unit back to program space.
| [in] | program_space | The ray in this unit's space. |
Implements Unit.
Definition at line 492 of file UnitTypes.h.
|
inlinenodiscardoverridevirtual |
Converts a 3D vertex from this unit back to program space.
| [in] | program_space | The vertex in this unit's space. |
Implements Unit.
Definition at line 472 of file UnitTypes.h.
|
inlinenodiscardoverridevirtual |
Converts a scalar from program space to this unit using scale and offset.
| [in] | program_space | The value in program space. |
| [in] | direction | The axis direction for the conversion. |
Implements Unit.
Definition at line 437 of file UnitTypes.h.
|
inlinenodiscardoverridevirtual |
Converts a 3D ray from program space to this unit using scale and offset.
| [in] | program_space | The ray in program space. |
Implements Unit.
Definition at line 482 of file UnitTypes.h.
|
inlinenodiscardoverridevirtual |
Converts a 3D vertex from program space to this unit using scale and offset.
| [in] | program_space | The vertex in program space. |
Implements Unit.
Definition at line 462 of file UnitTypes.h.
Returns the transformation matrix representing this unit's scale.
Implements Unit.
Definition at line 522 of file UnitTypes.h.
References scale.
Returns the sub-unit for the given axis direction.
| [in] | direction | The axis direction. |
Implements Unit.
Definition at line 513 of file UnitTypes.h.
References Unit::Unit().