CARMA C++
|
The Angle class can represent any angle in any units. More...
#include <carma/services/Angle.h>
Public Member Functions | |
Angle () | |
Default constructor. More... | |
Angle (double value, const std::string &units) | |
Construct an Angle given a value and units. More... | |
double | arcMinutes (bool modulo=false) const |
Convenience method that returns the value of this angle in arcminutes. More... | |
double | arcSeconds (bool modulo=false) const |
Convenience method that returns the value of this angle in arcseconds. More... | |
double | degrees (bool modulo=false) const |
Convenience method that returns the value of this angle in degrees. More... | |
std::string | dms (bool modulo=true, int precision=0) const |
double | hours (bool modulo=true) const |
Convenience method that returns the value of this angle in hours. More... | |
Angle & | operator*= (double scalar) |
Multiply an angle by a scalar. More... | |
const Angle | operator+ (const Angle &angle) const |
Add two Angles. More... | |
Angle & | operator+= (const Angle &angle) |
Add Angle. More... | |
const Angle | operator- (const Angle &angle) const |
Subtract two Angles. More... | |
Angle & | operator-= (const Angle &angle) |
Subtract Angle. More... | |
const Angle | operator/ (double scalar) const |
Divide an angle by a scalar. More... | |
Angle & | operator/= (double scalar) |
Divide by a scalar. More... | |
bool | operator< (const Angle &right) const |
Less than comparison. More... | |
bool | operator<= (const Angle &right) const |
Less than or equal comparison. More... | |
bool | operator> (const Angle &right) const |
Greater than comparison. More... | |
bool | operator>= (const Angle &right) const |
Greater than or equal comparison. More... | |
double | radians (bool modulo=true) const |
Convenience method that returns the value of this angle in radians. More... | |
void | setRadians (double radians) |
Set the value of this angle in radians. More... | |
virtual | ~Angle () |
Destructor. More... | |
![]() | |
ConformableQuantity (double value, const std::string &units) | |
Construct an ConformableQuantity given a value and units. More... | |
virtual double | convert (const std::string &convertTo) const |
Converts this quantity to any conformable units. More... | |
virtual std::string | getUnits () const |
double | getValue () const |
virtual const ConformableQuantity | operator+ (const ConformableQuantity &quantity) const |
Add two ConformableQuantities. More... | |
virtual ConformableQuantity & | operator+= (const ConformableQuantity &quantity) |
Add ConformableQuantity to itself. More... | |
virtual const ConformableQuantity | operator- (const ConformableQuantity &quantity) const |
Subtract two ConformableQuantities. More... | |
virtual ConformableQuantity & | operator-= (const ConformableQuantity &quantity) |
Subtract ConformableQuantity from itself. More... | |
virtual void | reset (double value, const std::string &units) |
Reset method to change value and/or units. More... | |
virtual | ~ConformableQuantity () |
Destructor. More... | |
Static Public Member Functions | |
static std::string | getString (double angle, int precision=0) |
Return a zero filled string +/-ddd:mm:ss.s. More... | |
Static Public Attributes | |
static const std::string | ARCMIN_STR |
A const string that may be used for unit conversion. More... | |
static const std::string | ARCSEC_STR |
A const string that may be used for unit conversion. More... | |
static const std::string | DEGREES_STR |
A const string that may be used for unit conversion. More... | |
static const std::string | HOURS_STR |
A const string that may be used for unit conversion. More... | |
static const std::string | RADIANS_STR |
A const string that may be used for unit conversion. More... | |
Static Protected Member Functions | |
static std::string | getAngleString (double a, int precision=0, bool dms=true, bool useSign=false) |
Static Protected Attributes | |
static const double | twoPi_ = 2 * M_PIl |
Two pi. More... | |
Friends | |
const Angle | operator* (double left, const Angle &right) |
Multiply an angle by a scalar. More... | |
const Angle | operator* (const Angle &left, double right) |
Additional Inherited Members | |
![]() | |
Units | u_ |
Used for converting between units. More... | |
The Angle class can represent any angle in any units.
It uses the Units class internally to handle conversion of any angular unit to any other angular unit. For example,
Angle angle1(M_PI,"radians")
both
Angle angle2(180.0,"degrees")
angle1
and angle2
represent the same physical quantity. Binary operations + and - are supported, as is the stream operation <<. This class was inspired by Erik Leitch's sza::util::Angle.
|
explicit |
Default constructor.
Constructs an angle of value 0.0.
|
explicit |
Construct an Angle given a value and units.
value | The value of this angle |
units | The units of the value. |
|
virtual |
Destructor.
double carma::services::Angle::arcMinutes | ( | bool | modulo = false | ) | const |
Convenience method that returns the value of this angle in arcminutes.
modulo | Whether or not to return the value modulo 21600 arcminutes (=360 degrees) or not; false if you do want modulo 21600 arcminutes ; default is FALSe; |
double carma::services::Angle::arcSeconds | ( | bool | modulo = false | ) | const |
Convenience method that returns the value of this angle in arcseconds.
modulo | Whether or not to return the value modulo 1296000 arcseconds (=360 degrees) or not; false if you do want modulo 1296000 arcseconds; default is FALSE; |
double carma::services::Angle::degrees | ( | bool | modulo = false | ) | const |
Convenience method that returns the value of this angle in degrees.
modulo | Whether or not to return the value modulo 360 degrees or not; false if you do want modulo 360 degrees; default is FALSE; |
std::string carma::services::Angle::dms | ( | bool | modulo = true , |
int | precision = 0 |
||
) | const |
modulo | Whether or not to return the value modulo 360 degrees or not; false if you do want modulo 360 degrees; default is true; |
precision | digits to the right of the decimal for seconds |
|
static |
double carma::services::Angle::hours | ( | bool | modulo = true | ) | const |
Convenience method that returns the value of this angle in hours.
modulo | Whether or not to return the value modulo 24 hours or not; false if you do want modulo 24 hours; default is true; |
Angle& carma::services::Angle::operator*= | ( | double | scalar | ) |
Multiply an angle by a scalar.
Add two Angles.
ConformabilityException |
Add Angle.
ConformabilityException |
Subtract two Angles.
ConformabilityException |
Subtract Angle.
ConformabilityException |
const Angle carma::services::Angle::operator/ | ( | double | scalar | ) | const |
Divide an angle by a scalar.
Angle& carma::services::Angle::operator/= | ( | double | scalar | ) |
Divide by a scalar.
bool carma::services::Angle::operator< | ( | const Angle & | right | ) | const |
Less than comparison.
bool carma::services::Angle::operator<= | ( | const Angle & | right | ) | const |
Less than or equal comparison.
bool carma::services::Angle::operator> | ( | const Angle & | right | ) | const |
Greater than comparison.
bool carma::services::Angle::operator>= | ( | const Angle & | right | ) | const |
Greater than or equal comparison.
double carma::services::Angle::radians | ( | bool | modulo = true | ) | const |
Convenience method that returns the value of this angle in radians.
modulo | Whether or not to return the value modulo 2PI or not; false if you do want modulo 2PI; default is true; |
void carma::services::Angle::setRadians | ( | double | radians | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
staticprotected |