Public Member Functions | Protected Attributes | Private Member Functions | List of all members
gnsstk::Angle Class Reference

Detailed Description

Wrap data for an angle, including the angle in degrees, radians, and the sine and cosine of the angle. This is done for convenience when doing geometric computations that require the use of a lot of trigonometry.

Definition at line 53 of file Angle.hpp.

#include <Angle.hpp>

Inheritance diagram for gnsstk::Angle:
Inheritance graph
[legend]

Public Member Functions

 Angle ()
 Initialize all data to NaN. More...
 
 Angle (double s, double c)
 
 Angle (double v, AngleType t)
 
std::string asString () const
 
double deg () const
 Get the angle in degrees. More...
 
Angle operator+ (const Angle &right) const
 
Angle operator- () const
 
Angle operator- (const Angle &right) const
 
double rad () const
 Get the angle in radians. More...
 
double semicirc () const
 Get the angle in semi-circles (aka half-cycles). More...
 
void setValue (double v, AngleType t)
 
double tan () const
 Get the tangent of this angle. More...
 
- Public Member Functions inherited from gnsstk::AngleReduced
 AngleReduced ()
 Initialize all data to NaN. More...
 
 AngleReduced (double s, double c)
 
 AngleReduced (double v, AngleType t)
 
std::string asString () const
 Return a string containing the data separated by commas (sin,cos). More...
 
double cos () const
 Get the cosine of this angle. More...
 
bool operator== (const AngleReduced &right) const
 Standard equality operator. More...
 
void setValue (double v, AngleType t)
 
double sin () const
 Get the sine of this angle. More...
 

Protected Attributes

double degrees
 The angle in degrees. More...
 
double radians
 The angle in radians. More...
 
double semicircles
 The angle in semi-circles (aka half-cycles). More...
 
double tangent
 The tangent of the angle. More...
 
- Protected Attributes inherited from gnsstk::AngleReduced
double cosine
 The cosine of the angle. More...
 
double sine
 The sine of the angle. More...
 

Private Member Functions

 Angle (int, int)
 
 Angle (long, long)
 
 Angle (unsigned long, unsigned long)
 
 Angle (unsigned, unsigned)
 

Constructor & Destructor Documentation

◆ Angle() [1/7]

gnsstk::Angle::Angle ( )

Initialize all data to NaN.

Definition at line 47 of file Angle.cpp.

◆ Angle() [2/7]

gnsstk::Angle::Angle ( double  s,
double  c 
)
explicit

Initialize from a pair of sin/cos values, filling out the rest.

Parameters
[in]sThe sine of the angle.
[in]cThe cosine of the angle.
Postcondition
rad, deg, sin and cos are all set.

Definition at line 57 of file Angle.cpp.

◆ Angle() [3/7]

gnsstk::Angle::Angle ( double  v,
AngleType  t 
)
inlineexplicit

Initialize from a single value, filling out the rest.

Parameters
[in]vThe value to set.
[in]tThe type of datum contained in v.
Postcondition
rad, deg, sin and cos are all set.

Definition at line 69 of file Angle.hpp.

◆ Angle() [4/7]

gnsstk::Angle::Angle ( int  ,
int   
)
explicitprivate

◆ Angle() [5/7]

gnsstk::Angle::Angle ( long  ,
long   
)
explicitprivate

◆ Angle() [6/7]

gnsstk::Angle::Angle ( unsigned  ,
unsigned   
)
explicitprivate

◆ Angle() [7/7]

gnsstk::Angle::Angle ( unsigned long  ,
unsigned long   
)
explicitprivate

Member Function Documentation

◆ asString()

std::string gnsstk::Angle::asString ( ) const

Return a string containing the data separated by commas (rad,deg,sin,cos).

Definition at line 138 of file Angle.cpp.

◆ deg()

double gnsstk::Angle::deg ( ) const
inline

Get the angle in degrees.

Definition at line 98 of file Angle.hpp.

◆ operator+()

Angle gnsstk::Angle::operator+ ( const Angle right) const

Basic addition.

Parameters
[in]rightThe angle to add to this one.
Returns
The resulting angle when added to this one.

Definition at line 129 of file Angle.cpp.

◆ operator-() [1/2]

Angle gnsstk::Angle::operator- ( ) const
inline

Numeric negation of angle. Changes radians to -radians then recomputes the rest.

Definition at line 85 of file Angle.hpp.

◆ operator-() [2/2]

Angle gnsstk::Angle::operator- ( const Angle right) const

Basic difference.

Parameters
[in]rightThe angle to subtract from this one.
Returns
The resulting angle when differenced with this one.

Definition at line 120 of file Angle.cpp.

◆ rad()

double gnsstk::Angle::rad ( ) const
inline

Get the angle in radians.

Definition at line 94 of file Angle.hpp.

◆ semicirc()

double gnsstk::Angle::semicirc ( ) const
inline

Get the angle in semi-circles (aka half-cycles).

Definition at line 102 of file Angle.hpp.

◆ setValue()

void gnsstk::Angle::setValue ( double  v,
AngleType  t 
)

Set all values from a single angle datum.

Parameters
[in]vThe value to set.
[in]tThe type of datum contained in v.
Postcondition
rad, deg, sin and cos are all set.

Definition at line 68 of file Angle.cpp.

◆ tan()

double gnsstk::Angle::tan ( ) const
inline

Get the tangent of this angle.

Definition at line 106 of file Angle.hpp.

Member Data Documentation

◆ degrees

double gnsstk::Angle::degrees
protected

The angle in degrees.

Definition at line 115 of file Angle.hpp.

◆ radians

double gnsstk::Angle::radians
protected

The angle in radians.

Definition at line 114 of file Angle.hpp.

◆ semicircles

double gnsstk::Angle::semicircles
protected

The angle in semi-circles (aka half-cycles).

Definition at line 117 of file Angle.hpp.

◆ tangent

double gnsstk::Angle::tangent
protected

The tangent of the angle.

Definition at line 116 of file Angle.hpp.


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


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:44