NDEVR
API Documentation

Contains logic for converting angles into user defined units including up-direction and clockwise-logic. More...

Inheritance diagram for AngleUnit:
[legend]
Collaboration diagram for AngleUnit:
[legend]

Public Member Functions

 AngleUnit (const StringView &name, const TranslatedString &translated_name, const TranslatedString &abbreviation, fltp08 scale)
 Constructs an AngleUnit with the given scale factor.
virtual Unitclone (const StringView &name, const TranslatedString &translated_id) const override
 Creates a copy of this angle unit with a new name and display name.
virtual fltp08 convertFromUnit (const fltp08 &program_space, uint01 direction=X) const override
 Converts a scalar angle from this unit back to program space.
virtual Ray< 3, fltp08convertFromUnit (const Ray< 3, fltp08 > &program_space) const override
 Converts a 3D ray of angles from this unit back to program space.
virtual Vertex< 3, fltp08convertFromUnit (const Vertex< 3, fltp08 > &program_space) const override
 Converts a 3D vertex of angles from this unit back to program space.
virtual fltp08 convertToUnit (const fltp08 &program_space, uint01 direction=X) const override
 Converts a scalar angle from program space to this unit.
virtual Ray< 3, fltp08convertToUnit (const Ray< 3, fltp08 > &program_space) const override
 Converts a 3D ray of angles from program space to this unit.
virtual Vertex< 3, fltp08convertToUnit (const Vertex< 3, fltp08 > &program_space) const override
 Converts a 3D vertex of angles from program space to this unit.
virtual fltp08 denormalize (fltp08 value, uint01 direction) const
 Reverses normalization on an angle value for the given axis.
virtual fltp08 epsilon (fltp08 value, uint01 direction=X) const override
 Returns the smallest meaningful angular difference for a value in this unit.
virtual fltp08 normalize (fltp08 value, uint01 direction) const
 Normalizes an angle value to its canonical range for the given axis.
Public Member Functions inherited from ScaledUnit
 ScaledUnit (StringView name, TranslatedString translated_id, TranslatedString abbreviation, fltp08 scale)
 Constructs a ScaledUnit with the given scale factor and abbreviation.
virtual const TranslatedStringabbreviation (uint01 direction=X) const override
 Returns the translated abbreviation for this unit.
virtual fltp08 convertFromString (const StringView &unit_string, uint01 direction=X) const override
 Converts a unit-formatted string to a program-space value.
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 override
 Converts a program-space scalar to a formatted display string.
virtual fltp08 fromString (const StringView &unit_string, uint01 direction=X) const override
 Parses a string directly into a numeric value in this unit's space.
virtual Matrix< fltp08matrix () const override
 Returns the transformation matrix representing this unit's scale.
virtual const UnitsubUnit (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 Unitclone () 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.
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.
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 StringView getNextPreferredSeparator (const StringView &current_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

Vector< 3, bool > normalized = Vector<3, bool>(false)
 Per-axis flags indicating whether angles should be normalized to their range.
fltp08 period = 2.0 * Angle<fltp08>::INDEX_PI
 The full period of the angle in internal units (default 2*PI).
Vector< 3, fltp08reflex_point = Constant<Vector<3, fltp08>>::Invalid
 Per-axis reflex points where angle wrapping behavior changes.
Vector< 3, bool > reflexes_up = Vector<3, bool>(false)
 Per-axis flags indicating the direction of reflex angle wrapping.
Vector< 3, fltp08upper_limits = Vector<3, fltp08>(2.0 * Angle<fltp08>::INDEX_PI)
 Per-axis upper limits for angle normalization.
Public Attributes inherited from ScaledUnit
const TranslatedString core_abbreviation
 The translated abbreviation displayed for this unit.
const fltp08 scale
 The multiplicative scale factor used for conversion to this unit.
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.

Protected Member Functions

 AngleUnit (const StringView &name, const TranslatedString &translated_name, const TranslatedString &abbreviation, fltp08 scale, const Vector< 3, bool > &normalized, const Vector< 3, fltp08 > &upper_limits, const Vector< 3, fltp08 > &reflexes, const Vector< 3, bool > &reflexes_up)
 Constructs an AngleUnit with full configuration for normalization and reflexes.

Additional Inherited Members

Static Protected Member Functions inherited from Unit
static Buffer< StringViewOperatorSplit (const StringView &string)
 Splits a string by operator characters for formula parsing.

Detailed Description

Contains logic for converting angles into user defined units including up-direction and clockwise-logic.


Class: AngleUnit

Definition at line 716 of file UnitTypes.h.

Constructor & Destructor Documentation

◆ AngleUnit() [1/2]

AngleUnit::AngleUnit ( const StringView & name,
const TranslatedString & translated_name,
const TranslatedString & abbreviation,
fltp08 scale )

Constructs an AngleUnit with the given scale factor.

Parameters
[in]nameThe internal identifier for this unit.
[in]translated_nameThe translated display name for this unit.
[in]abbreviationThe translated abbreviation for this unit.
[in]scaleThe multiplicative scale factor for angle conversion.

References ScaledUnit::abbreviation(), Unit::name, and ScaledUnit::scale.

Referenced by AngleUnit(), DDMMSSAngleUnit::DDMMSSAngleUnit(), ThreePartAngleUnit::ThreePartAngleUnit(), and TwoPartAngleUnit::TwoPartAngleUnit().

◆ AngleUnit() [2/2]

AngleUnit::AngleUnit ( const StringView & name,
const TranslatedString & translated_name,
const TranslatedString & abbreviation,
fltp08 scale,
const Vector< 3, bool > & normalized,
const Vector< 3, fltp08 > & upper_limits,
const Vector< 3, fltp08 > & reflexes,
const Vector< 3, bool > & reflexes_up )
protected

Constructs an AngleUnit with full configuration for normalization and reflexes.

Parameters
[in]nameThe internal identifier for this unit.
[in]translated_nameThe translated display name for this unit.
[in]abbreviationThe translated abbreviation for this unit.
[in]scaleThe multiplicative scale factor for angle conversion.
[in]normalizedPer-axis flags indicating whether the angle should be normalized.
[in]upper_limitsPer-axis upper limits for normalization.
[in]reflexesPer-axis reflex points for angle wrapping.
[in]reflexes_upPer-axis flags indicating the reflex direction.

References AngleUnit(), ScaledUnit::abbreviation(), Unit::name, normalized, reflexes_up, ScaledUnit::scale, and upper_limits.

Member Function Documentation

◆ clone()

virtual Unit * AngleUnit::clone ( const StringView & name,
const TranslatedString & translated_id ) const
nodiscardoverridevirtual

Creates a copy of this angle unit with a new name and display name.

Parameters
[in]nameThe internal identifier for the cloned unit.
[in]translated_idThe translated display name for the cloned unit.
Returns
A newly allocated clone of this unit.

Reimplemented from ScaledUnit.

Reimplemented in DDMMSSAngleUnit, ThreePartAngleUnit, and TwoPartAngleUnit.

References Unit::name, and Unit::translated_id.

◆ convertFromUnit() [1/3]

virtual fltp08 AngleUnit::convertFromUnit ( const fltp08 & program_space,
uint01 direction = X ) const
nodiscardoverridevirtual

Converts a scalar angle from this unit back to program space.

Parameters
[in]program_spaceThe angle value in this unit's space.
[in]directionThe axis direction for the conversion.
Returns
The angle converted back to program space (internal radians).

Reimplemented from ScaledUnit.

◆ convertFromUnit() [2/3]

virtual Ray< 3, fltp08 > AngleUnit::convertFromUnit ( const Ray< 3, fltp08 > & program_space) const
nodiscardoverridevirtual

Converts a 3D ray of angles from this unit back to program space.

Parameters
[in]program_spaceThe ray of angles in this unit's space.
Returns
The ray of angles converted back to program space.

Reimplemented from ScaledUnit.

◆ convertFromUnit() [3/3]

virtual Vertex< 3, fltp08 > AngleUnit::convertFromUnit ( const Vertex< 3, fltp08 > & program_space) const
nodiscardoverridevirtual

Converts a 3D vertex of angles from this unit back to program space.

Parameters
[in]program_spaceThe vertex of angles in this unit's space.
Returns
The vertex of angles converted back to program space.

Reimplemented from ScaledUnit.

◆ convertToUnit() [1/3]

virtual fltp08 AngleUnit::convertToUnit ( const fltp08 & program_space,
uint01 direction = X ) const
nodiscardoverridevirtual

Converts a scalar angle from program space to this unit.

Parameters
[in]program_spaceThe angle value in program space (internal radians).
[in]directionThe axis direction for the conversion.
Returns
The angle converted to this unit's space.

Reimplemented from ScaledUnit.

◆ convertToUnit() [2/3]

virtual Ray< 3, fltp08 > AngleUnit::convertToUnit ( const Ray< 3, fltp08 > & program_space) const
nodiscardoverridevirtual

Converts a 3D ray of angles from program space to this unit.

Parameters
[in]program_spaceThe ray of angles in program space.
Returns
The ray of angles converted to this unit's space.

Reimplemented from ScaledUnit.

◆ convertToUnit() [3/3]

virtual Vertex< 3, fltp08 > AngleUnit::convertToUnit ( const Vertex< 3, fltp08 > & program_space) const
nodiscardoverridevirtual

Converts a 3D vertex of angles from program space to this unit.

Parameters
[in]program_spaceThe vertex of angles in program space.
Returns
The vertex of angles converted to this unit's space.

Reimplemented from ScaledUnit.

◆ denormalize()

virtual fltp08 AngleUnit::denormalize ( fltp08 value,
uint01 direction ) const
nodiscardvirtual

Reverses normalization on an angle value for the given axis.

Parameters
[in]valueThe normalized angle value.
[in]directionThe axis direction.
Returns
The denormalized angle value.

◆ epsilon()

virtual fltp08 AngleUnit::epsilon ( fltp08 value,
uint01 direction = X ) const
nodiscardoverridevirtual

Returns the smallest meaningful angular difference for a value in this unit.

Parameters
[in]valueThe value to compute epsilon for.
[in]directionThe axis direction.
Returns
The epsilon value for the given input.

Reimplemented from Unit.

Reimplemented in DDMMSSAngleUnit, ThreePartAngleUnit, and TwoPartAngleUnit.

◆ normalize()

virtual fltp08 AngleUnit::normalize ( fltp08 value,
uint01 direction ) const
nodiscardvirtual

Normalizes an angle value to its canonical range for the given axis.

Parameters
[in]valueThe angle value to normalize.
[in]directionThe axis direction.
Returns
The normalized angle value.

The documentation for this struct was generated from the following file: