API Documentation
Loading...
Searching...
No Matches
Angle< t_type > Class Template Reference

The primary angle storage class for this API. Stores an angle in an optimized format. More...

#include <Angle.h>

Public Member Functions

constexpr Angle ()
 Default constructor, creates an angle with 0 degrees.
 
constexpr Angle (AngleType type, fltp04 value)
 Angle Constructor.
 
constexpr Angle (AngleType type, fltp08 value)
 Angle Constructor.
 
constexpr Angle (const Angle &angle)
 Default copy constructor.
 
template<class t_other_type >
constexpr Angle (const Angle< t_other_type > &angle)
 Explicit conversion of an angle from one container type to another.
 
constexpr Angle (t_type value)
 Constructor.
 
template<AngleType t_angle_type>
constexpr fltp08 as () const
 Returns a form of this angle as a given type (Radian, Degree, Percent, etc) The template t_type provides the AngleType of the angle to return (Example: radians, degrees, percent)
 
constexpr fltp08 as (AngleType type) const
 Returns a form of this angle as a given type (Radian, Degree, Percent, etc)
 
template<bool t_normalized>
constexpr t_type internal () const
 Gets the internal index angle which is the default storage unit for the angle data.
 
constexpr Angle normalized () const
 returns the normalized angle which lies from 0 to 360 degrees.
 
constexpr Angle normalizedOffset () const
 returns the normalized angle which lies from -180 to 180 degrees.
 
constexpr bool operator!= (const Angle &angle) const
 Inequality operator.
 
Angle operator- () const
 negates the angle
 
constexpr Angleoperator= (const Angle &angle)
 
constexpr bool operator== (const Angle &angle) const
 Equality operator.
 
template<class t_new_type >
constexpr Angle< t_new_type > toTypeAngle () const
 Explicit conversion of an angle from one container type to another.
 

Static Public Member Functions

template<class t_value_type >
static Angle acos (t_value_type value)
 Computes the principal value of the arc cosine of the given value.
 
template<class t_value_type >
static Angle asin (t_value_type value)
 Computes the principal value of the arc sine of the given value.
 
template<class t_value_type >
static Angle atan (t_value_type value)
 Computes the principal value of the arc tangent of the given value.
 
template<class t_value_type >
static Angle atan2 (t_value_type x, t_value_type y)
 measures the counterclockwise angle between the positive x-axis and the point (x, y)
 

Static Public Attributes

static constexpr sint04 INDEX_PI = 32768
 
static constexpr fltp08 INV_INDEX_PI = { 1.0 / Angle<t_type>::INDEX_PI }
 

Protected Attributes

t_type m_index_angle
 

Detailed Description

template<class t_type>
class NDEVR::Angle< t_type >

The primary angle storage class for this API. Stores an angle in an optimized format.


Since all angles are from 0-360 degrees it is possible to make certain optimizations that make use of defined overflow that traditional floating point angles would not be able to achieve. In addition space can be saved and expensive sin, cos, tan functions can be precomputed.

Constructor & Destructor Documentation

◆ Angle() [1/6]

template<class t_type >
Angle ( )
inlineconstexpr

Default constructor, creates an angle with 0 degrees.

◆ Angle() [2/6]

template<class t_type >
Angle ( const Angle< t_type > & angle)
inlineconstexpr

Default copy constructor.

◆ Angle() [3/6]

template<class t_type >
template<class t_other_type >
Angle ( const Angle< t_other_type > & angle)
inlineexplicitconstexpr

Explicit conversion of an angle from one container type to another.

◆ Angle() [4/6]

template<class t_type >
Angle ( AngleType type,
fltp04 value )
inlineexplicitconstexpr

Angle Constructor.

Parameters
[in]typeThe type of the angle given (Example: radians, degrees, percent)
[in]valueThe value of the angle in the units specified by type.

◆ Angle() [5/6]

template<class t_type >
Angle ( AngleType type,
fltp08 value )
inlineexplicitconstexpr

Angle Constructor.

Parameters
[in]typeThe type of the angle given (Example: radians, degrees, percent)
[in]valueThe value of the angle in the units specified by type.

◆ Angle() [6/6]

template<class t_type >
Angle ( t_type value)
inlineexplicitconstexpr

Constructor.

Parameters
[in]valuethe optimized input where INDEX_PI is 180 degrees

Member Function Documentation

◆ acos()

template<class t_type >
template<class t_value_type >
static Angle acos ( t_value_type value)
inlinestatic

Computes the principal value of the arc cosine of the given value.

Parameters
[in]value- The value to perform arc cos.
Returns
the arc cosine of the given value as an Angle.

◆ as() [1/2]

template<class t_type >
template<AngleType t_angle_type>
fltp08 as ( ) const
inlinenodiscardconstexpr

Returns a form of this angle as a given type (Radian, Degree, Percent, etc) The template t_type provides the AngleType of the angle to return (Example: radians, degrees, percent)

Parameters
[in]t_is_signedWhether the given type should be signed or not (-180 - 180 vs 0 to 360)
Returns
A fltp08 representing this angle as the given type.

◆ as() [2/2]

template<class t_type >
fltp08 as ( AngleType type) const
inlinenodiscardconstexpr

Returns a form of this angle as a given type (Radian, Degree, Percent, etc)

Parameters
[in]type- The AngleType of the angle to return (Example: radians, degrees, percent).
Returns
A fltp04 representing this angle as the given type.

◆ asin()

template<class t_type >
template<class t_value_type >
static Angle asin ( t_value_type value)
inlinestatic

Computes the principal value of the arc sine of the given value.

Parameters
[in]value- The value to perform arc sine.
Returns
the arc sine of the given value as an Angle.

◆ atan()

template<class t_type >
template<class t_value_type >
static Angle atan ( t_value_type value)
inlinestatic

Computes the principal value of the arc tangent of the given value.

Parameters
[in]value- The value to perform arc tangent.
Returns
the arc tangent of the given value as an Angle.

◆ atan2()

template<class t_type >
template<class t_value_type >
static Angle atan2 ( t_value_type x,
t_value_type y )
inlinestatic

measures the counterclockwise angle between the positive x-axis and the point (x, y)

Parameters
[in]x- the numerator or x value of atan
[in]y- the denomenator or y value of atan
Returns
the arc tangent of the given value as an Angle.

◆ internal()

template<class t_type >
template<bool t_normalized>
t_type internal ( ) const
inlinenodiscardconstexpr

Gets the internal index angle which is the default storage unit for the angle data.

Returns
The internal index angle, or the angle represented by 0 - Constant<t_type>::Max representing 0 to 2 PI radians

◆ normalized()

template<class t_type >
Angle normalized ( ) const
inlinenodiscardconstexpr

returns the normalized angle which lies from 0 to 360 degrees.

◆ normalizedOffset()

template<class t_type >
Angle normalizedOffset ( ) const
inlinenodiscardconstexpr

returns the normalized angle which lies from -180 to 180 degrees.

◆ operator!=()

template<class t_type >
bool operator!= ( const Angle< t_type > & angle) const
inlineconstexpr

Inequality operator.

Parameters
[in]angleThe value to check inequality against.
Returns
true if the left and right are not considered equivalent.

◆ operator-()

template<class t_type >
Angle operator- ( ) const
inline

negates the angle

Returns
The result of the operation.

◆ operator=()

template<class t_type >
Angle & operator= ( const Angle< t_type > & angle)
inlineconstexpr
Parameters
[in]angle- The value to assign.
Returns
A shallow copy of this object.

◆ operator==()

template<class t_type >
bool operator== ( const Angle< t_type > & angle) const
inlineconstexpr

Equality operator.

Parameters
[in]angle- The value to check comparison.
Returns
true if the left and right are considered equivalent.

◆ toTypeAngle()

template<class t_type >
template<class t_new_type >
Angle< t_new_type > toTypeAngle ( ) const
inlineconstexpr

Explicit conversion of an angle from one container type to another.

Member Data Documentation

◆ INDEX_PI

template<class t_type >
sint04 INDEX_PI = 32768
staticconstexpr

◆ INV_INDEX_PI

template<class t_type >
fltp08 INV_INDEX_PI = { 1.0 / Angle<t_type>::INDEX_PI }
staticconstexpr

◆ m_index_angle

template<class t_type >
t_type m_index_angle
protected

The index angle.


The documentation for this class was generated from the following files: