USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::Angle Class Reference

Defines an angle and provides unit conversions. More...

#include <Angle.h>

Inherited by Isis::Latitude, and Isis::Longitude.

List of all members.

Public Types

enum  Units { Degrees, Radians }
 

The set of usable angle measurement units.

More...

Public Member Functions

 Angle ()
 Constructs a blank angle object which needs a value to be set in order to do any calculations.
 Angle (double angle, Units unit)
 Constructs an angle object with the entered value and unit.
 Angle (const Angle &angle)
 Constructs an angle object from another Angle object.
virtual ~Angle ()
 Destroys the angle object.
bool Valid () const
 This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
Angleoperator= (const Angle &angle2)
 Assign angle object equal to another.
Angle operator+ (const Angle &angle2) const
 Add angle value to another.
Angle operator- (const Angle &angle2) const
 Subtract angle value from another and return the resulting angle.
Angle operator* (double value) const
 Multiply this angle by a double and return the resulting angle.
Angle operator/ (double value) const
 Divide this angle by a double.
double operator/ (Angle value) const
 Divide this angle by another angle and return the ratio.
bool operator< (const Angle &angle2) const
 Test if the other angle is less than the current angle.
bool operator> (const Angle &angle2) const
 Test if the other angle is greater than the current angle.
void operator+= (const Angle &angle2)
 Add angle value to another as double and replace original.
void operator-= (const Angle &angle2)
 Subtract angle value from another and set this instance to the resulting angle.
Angle operator* (int value) const
 Multiply this angle by an integer and return the resulting angle.
void operator*= (double value)
 Multiply this angle by a double and set this instance to the resulting angle.
Angle operator/ (int value) const
 Divide this angle by an integer and return the resulting angle.
void operator/= (double value)
 Divide this angle by a double and return the resulting angle.
bool operator== (const Angle &angle2) const
 Test if another angle is equal to this angle.
bool operator!= (const Angle &angle2) const
 Test if another angle is not equal to this angle.
bool operator<= (const Angle &angle2) const
 Test if the other angle is less than or equal to the current angle.
bool operator>= (const Angle &angle2) const
 Test if the other angle is greater than or equal to the current angle.
double GetRadians () const
 Convert an angle to a double.
double GetDegrees () const
 Get the angle in units of Degrees.
void SetRadians (double radians)
 Set the angle in units of Radians.
void SetDegrees (double degrees)
 Set the angle in units of Degrees.

Protected Member Functions

double UnitWrapValue (const Units &unit) const
 Return wrap value in desired units.
virtual double GetAngle (const Units &unit) const
 Return angle value in desired units.
virtual void SetAngle (const double &angle, const Units &unit)
 Set angle value in desired units.

Friends

Angle operator* (double mult, Angle angle)
 Multiply this angle by a double and return the resulting angle.

Detailed Description

Defines an angle and provides unit conversions.

Author:
2010-10-09 Debbie A. Cook

Member Enumeration Documentation

The set of usable angle measurement units.

Enumerator:
Degrees 

Degrees are generally considered more human readable, 0-360 is one circle, however most math does not use this unit.

Use these for displaying to the user and accepting input from the user.

Radians 

Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more difficult for users to understand when displayed since they have PI in them.

This is the default unit and is necessary for most math library calls.


Constructor & Destructor Documentation

Isis::Angle::Angle (  ) 

Constructs a blank angle object which needs a value to be set in order to do any calculations.

References Isis::Null.

Referenced by Isis::Latitude::GetPlanetographic(), operator+(), and operator/().

Isis::Angle::Angle ( double  angle,
Units  unit 
)

Constructs an angle object with the entered value and unit.

Parameters:
angle The initial angle value in units of the unit parameter
unit The unit of the initial angle (see Angle::Units)
Isis::Angle::Angle ( const Angle fromAngle  ) 

Constructs an angle object from another Angle object.

Parameters:
fromAngle The angle object to copy on initialization
Isis::Angle::~Angle (  )  [virtual]

Destroys the angle object.


Member Function Documentation

double Isis::Angle::GetAngle ( const Units unit  )  const [protected, virtual]

Return angle value in desired units.

Parameters:
unit Desired units of the angle (see Angle::Units)
Returns:
angle value in specified units

References _FILEINFO_, Degrees, Isis::iException::Message(), Isis::Null, Isis::iException::Programmer, Isis::RAD2DEG(), and Radians.

Referenced by GetDegrees(), Isis::Longitude::GetPositiveEast(), Isis::Longitude::GetPositiveWest(), GetRadians(), operator<(), operator==(), and operator>().

double Isis::Angle::GetDegrees (  )  const [inline]
double Isis::Angle::GetRadians (  )  const [inline]
bool Isis::Angle::operator!= ( const Angle angle2  )  const [inline]

Test if another angle is not equal to this angle.

Takes the negated result of the '==' operator.

Parameters:
angle2 The comparison angle (on right-hand-side of != operator)
Returns:
true if the angle does not equal the comparision angle
Angle Isis::Angle::operator* ( int  value  )  const [inline]

Multiply this angle by an integer and return the resulting angle.

Parameters:
value The integer value to multiply with this angle
Returns:
Product of the angles
Angle Isis::Angle::operator* ( double  value  )  const

Multiply this angle by a double and return the resulting angle.

If this is an invalid angle, then the result will be an invalid angle.

Parameters:
value The value to multiply to this angle
Returns:
Multiplied angle
void Isis::Angle::operator*= ( double  value  )  [inline]

Multiply this angle by a double and set this instance to the resulting angle.

Parameters:
value The double value to multiply with this angle
Angle Isis::Angle::operator+ ( const Angle angle2  )  const

Add angle value to another.

If either of these are invalid angles, then the result will be an invalid angle.

Parameters:
angle2 The angle to add to this angle
Returns:
sum angle

References Angle(), GetRadians(), Radians, and Valid().

void Isis::Angle::operator+= ( const Angle angle2  )  [inline]

Add angle value to another as double and replace original.

Parameters:
angle2 The angle to add to this angle
Returns:
sum angle, replaces original
Angle Isis::Angle::operator- ( const Angle angle2  )  const

Subtract angle value from another and return the resulting angle.

If either of these are invalid angles, then the result will be an invalid angle.

Parameters:
angle2 The angle to subtract from this angle
Returns:
difference angle
void Isis::Angle::operator-= ( const Angle angle2  )  [inline]

Subtract angle value from another and set this instance to the resulting angle.

Parameters:
angle2 The angle to subtract from this angle
Angle Isis::Angle::operator/ ( int  value  )  const [inline]

Divide this angle by an integer and return the resulting angle.

Parameters:
value The double value to use as the divisor
Returns:
Quotient of the angles
double Isis::Angle::operator/ ( Angle  value  )  const

Divide this angle by another angle and return the ratio.

Parameters:
value The ratio, Null if invalid
Returns:
Quotient of the angles

References GetRadians(), Isis::Null, and Valid().

Angle Isis::Angle::operator/ ( double  value  )  const

Divide this angle by a double.

Parameters:
value The double value to use as the divisor
Returns:
Quotient of the angles

References Angle(), GetRadians(), Radians, and Valid().

void Isis::Angle::operator/= ( double  value  )  [inline]

Divide this angle by a double and return the resulting angle.

Parameters:
value The double value to use as the divisor
bool Isis::Angle::operator< ( const Angle angle2  )  const

Test if the other angle is less than the current angle.

If either is invalid, then an exception will be thrown.

Parameters:
angle2 The comparison angle (on right-hand-side of < operator)
Returns:
True if the angle is less than the comparision angle

References _FILEINFO_, GetAngle(), Isis::iException::Message(), Isis::iException::Programmer, Radians, and Valid().

bool Isis::Angle::operator<= ( const Angle angle2  )  const [inline]

Test if the other angle is less than or equal to the current angle.

Parameters:
angle2 The comparison angle (on right-hand-side of < operator)
Returns:
true if the angle is less than or equal to the comparision angle
Angle& Isis::Angle::operator= ( const Angle angle2  )  [inline]

Assign angle object equal to another.

Parameters:
angle2 The angle value to copy
Returns:
The new angle value

References GetRadians(), Radians, and SetAngle().

bool Isis::Angle::operator== ( const Angle angle2  )  const [inline]

Test if another angle is equal to this angle.

This does not compensate for going around a circle: Angle(360, Angle::Degrees) does not equal Angle(0, Angle::Degrees)

Invalid angles are equal to each other.

Parameters:
angle2 The comparison angle (on right-hand-side of == operator)
Returns:
true if the angle equals the comparision angle

References GetAngle(), and Radians.

bool Isis::Angle::operator> ( const Angle angle2  )  const

Test if the other angle is greater than the current angle.

If either is invalid, then an exception will be thrown.

Parameters:
angle2 The comparison angle (on right-hand-side of > operator)
Returns:
True if the angle is greater than the comparision angle

References _FILEINFO_, GetAngle(), Isis::iException::Message(), Isis::iException::Programmer, Radians, and Valid().

bool Isis::Angle::operator>= ( const Angle angle2  )  const [inline]

Test if the other angle is greater than or equal to the current angle.

Parameters:
angle2 The comparison angle (on right-hand-side of < operator)
Returns:
true if the angle is greater than or equal to the comparision angle
void Isis::Angle::SetAngle ( const double &  angle,
const Units unit 
) [protected, virtual]

Set angle value in desired units.

Parameters:
angle The angle value in units of the unit parameter
unit Desired units of the angle (see Angle::Units)

References _FILEINFO_, Isis::DEG2RAD(), Degrees, Isis::IsSpecial(), Isis::iException::Message(), Isis::Null, Isis::iException::Programmer, and Radians.

Referenced by operator=(), SetDegrees(), and SetRadians().

void Isis::Angle::SetDegrees ( double  degrees  )  [inline]

Set the angle in units of Degrees.

Parameters:
degrees The new angle value, Null for invalid angle

References Degrees, and SetAngle().

void Isis::Angle::SetRadians ( double  radians  )  [inline]

Set the angle in units of Radians.

Parameters:
radians The new angle value, Null for invalid angle

References Radians, and SetAngle().

double Isis::Angle::UnitWrapValue ( const Units unit  )  const [protected]

Return wrap value in desired units.

The 'wrap' value is the value where one circle occurs - angles greater than this are conceptually 'wrapping' back to zero. For example, this is 2*PI in radians because 2*PI == 0 on a circle. Please keep in mind we still differentiate those two angles.

Parameters:
unit Desired units of the Angle wrap constant (see Angle::Units)
Returns:
Wrap value in specified units

Referenced by Isis::Longitude::GetPositiveWest().

bool Isis::Angle::Valid (  )  const

Friends And Related Function Documentation

Angle operator* ( double  mult,
Angle  angle 
) [friend]

Multiply this angle by a double and return the resulting angle.

If this is an invalid angle, then the result will be an invalid angle.

Parameters:
mult The value to multiply to this angle
angle The angle being multiplied by mult
Returns:
Multiplied angle

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