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

Stores an angle in an optimized format. More...

#include <Angle.h>

Public Member Functions

constexpr Angle ()
 
constexpr Angle (const Angle &angle)
 
template<class t_other_type >
constexpr Angle (const Angle< t_other_type > &angle)
 
constexpr Angle (AngleType type, fltp04 value)
 
constexpr Angle (AngleType type, fltp08 value)
 
constexpr Angle (t_type value)
 
template<AngleType t_angle_type>
constexpr fltp08 as () const
 
constexpr fltp08 as (AngleType type) const
 
template<bool t_normalized>
constexpr t_type internal () const
 
template<class t_new_type >
constexpr Angle< t_new_type > toTypeAngle () const
 
constexpr Angle normalized () const
 
constexpr Angle normalizedOffset () const
 
constexpr Angleoperator= (const Angle &angle)
 
constexpr bool operator== (const Angle &angle) const
 
constexpr bool operator!= (const Angle &angle) const
 
Angle operator- () const
 

Static Public Member Functions

static Angle acos (fltp04 value)
 
static Angle acos (fltp08 value)
 
static Angle asin (fltp04 value)
 
static Angle asin (fltp08 value)
 
static Angle atan (fltp04 value)
 
static Angle atan (fltp08 value)
 
static fltp08 atan (Angle value)
 
static Angle atan2 (fltp04 value_a, fltp04 value_b)
 
static Angle atan2 (fltp08 value_a, fltp08 value_b)
 

Static Public Attributes

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

Static Protected Member Functions

template<class t_normal_type >
static constexpr std::enable_if<!ObjectInfo< t_normal_type >::Float, t_normal_type >::type NormalizeInternal (t_normal_type value)
 
template<class t_normal_type >
static constexpr std::enable_if< ObjectInfo< t_normal_type >::Float, t_normal_type >::type NormalizeInternal (t_normal_type value)
 

Protected Attributes

t_type m_index_angle
 

Detailed Description

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

Stores an angle in an optimized format.


Class: Angle

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.

Author: Tyler Parke

Date: 2017-11-13

Constructor & Destructor Documentation

◆ Angle() [1/6]

template<class t_type >
Angle ( )
inlineconstexpr

Fn: Angle::Angle();

Default constructor.

Author: Tyler Parke

Date: 2017-11-13

◆ Angle() [2/6]

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

◆ Angle() [3/6]

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

◆ Angle() [4/6]

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

Fn: explicit Angle::Angle(AngleType type, fltp04 value);

Constructor.

Author: Tyler Parke

Date: 2017-11-13

Parameters: type - The type of the angle given (Example: radians, degrees, percent)

value - The value of the angle in the units specified by type.

◆ Angle() [5/6]

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

Fn: explicit Angle::Angle(AngleType type, fltp08 value);

Constructor.

Author: Tyler Parke

Date: 2017-11-13

Parameters: type - The type of the angle given (Example: radians, degrees, percent)

value - The value of the angle in the units specified by type.

◆ Angle() [6/6]

template<class t_type >
Angle ( t_type value)
inlineexplicitconstexpr

Fn: explicit Angle::Angle(AngleType type, t_type value);

Constructor.

Author: Tyler Parke

Date: 2017-11-13

Parameters: type - The type of the angle given (Example: radians, degrees, percent)

value - The value of the angle in the units specified by type.

Member Function Documentation

◆ acos() [1/2]

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

Fn: static Angle Angle::acos(fltp04 value);

Acos the given value.

Author: Tyler Parke

Date: 2017-11-13

Parameters: value - The value.

Returns: An Angle.

◆ acos() [2/2]

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

◆ as() [1/2]

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

Fn: template<AngleType, bool t_is_signed> fltp04 Angle::as() const;

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

Author: Tyler Parke

Date: 2017-11-13

Typeparams: t_type - The type of the angle to return (Example: radians, degrees, percent) t_is_signed - Whether the given type should be signed or not (-180 - 180 vs 0 to 360)

Returns: A fltp04 representing this angle as the given type.

◆ as() [2/2]

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

Fn: template<bool t_is_signed> fltp04 Angle::as(AngleType type) const;

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

Author: Tyler Parke

Date: 2017-11-13

Typeparams: t_is_signed - Whether the given type should be signed or not (-180 - 180 vs 0 to 360) Parameters: type - The type of the angle to return (Example: radians, degrees, percent).

Returns: A fltp04 representing this angle as the given type.

◆ asin() [1/2]

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

Fn: static Angle Angle::asin(fltp04 value);

Gets the arc sin of a given value.

Author: Tyler Parke

Date: 2017-11-13

Parameters: value - The value.

Returns: An Angle.

◆ asin() [2/2]

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

◆ atan() [1/3]

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

◆ atan() [2/3]

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

◆ atan() [3/3]

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

◆ atan2() [1/2]

template<class t_type >
static Angle atan2 ( fltp04 value_a,
fltp04 value_b )
inlinestatic

◆ atan2() [2/2]

template<class t_type >
static Angle atan2 ( fltp08 value_a,
fltp08 value_b )
inlinestatic

◆ internal()

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

Fn: t_type Angle::internal() const

Gets the internal index angle.

Author: Tyler Parke

Date: 2017-11-13

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

◆ normalizedOffset()

template<class t_type >
Angle normalizedOffset ( ) const
inlinenodiscardconstexpr

◆ NormalizeInternal() [1/2]

template<class t_type >
template<class t_normal_type >
static constexpr std::enable_if<!ObjectInfo< t_normal_type >::Float, t_normal_type >::type NormalizeInternal ( t_normal_type value)
inlinestaticconstexprprotected

◆ NormalizeInternal() [2/2]

template<class t_type >
template<class t_normal_type >
static constexpr std::enable_if< ObjectInfo< t_normal_type >::Float, t_normal_type >::type NormalizeInternal ( t_normal_type value)
inlinestaticconstexprprotected

◆ operator!=()

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

Fn: bool Angle::operator!=(const Angle& value) const

Inequality operator.

Author: Tyler Parke

Date: 2017-11-13

Parameters: value - The value.

Returns: True if the left and right are not considered equivalent.

◆ operator-()

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

Fn: Angle Angle::operator-() const

Negation operator.

Author: Tyler Parke

Date: 2017-11-13

Returns: The result of the operation.

◆ operator=()

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

Fn: const Angle& Angle::operator=(const Angle& value)

Assignment operator.

Author: Tyler Parke

Date: 2017-11-13

Parameters: value - The value.

Returns: A shallow copy of this object.

◆ operator==()

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

Fn: bool Angle::operator==(const Angle& value) const

Equality operator.

Author: Tyler Parke

Date: 2017-11-13

Parameters: value - The value.

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

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: