16#include "IException.h"
17#include "SpecialPixel.h"
56 QString::SectionFlag flag = QString::SectionSkipEmpty;
57 bool degreesSucceeded, minutesSucceeded, secondsSucceeded;
59 double degrees =
angle.section(
' ', 0, 0, flag).toDouble(°reesSucceeded);
60 double minutes =
angle.section(
' ', 1, 1, flag).toDouble(&minutesSucceeded);
61 double seconds =
angle.section(
' ', 2, 2, flag).toDouble(&secondsSucceeded);
63 if (!(degreesSucceeded && minutesSucceeded && secondsSucceeded) ) {
64 QString msg = QObject::tr(
"[%1] is not a vaid input to Angle. It needs to be of the form: "
65 "\"dd mm ss.ss\"").arg(
angle);
66 throw IException(IException::Programmer, msg, _FILEINFO_);
75 double decimalDegrees =
degrees + minutes/60.0 + seconds/3600.0;
123 double otherAngle = angle2.
radians();
141 double otherAngle = angle2.
radians();
211 IString msg =
"Cannot compare a invalid angles with the < operator";
212 throw IException(IException::Programmer, msg, _FILEINFO_);
229 IString msg =
"Cannot compare a invalid angles with the > operator";
230 throw IException(IException::Programmer, msg, _FILEINFO_);
245 QString textResult =
"";
251 textResult +=
" degrees";
278 IString msg =
"Angle can not interpret the enumerated value [" +
279 IString(unit) +
"] as a unit";
280 throw IException(IException::Programmer, msg, _FILEINFO_);
296 double angleValue = Null;
308 if(angleValue == Null) {
309 IString msg =
"Angle can not interpret the enumerated value [" +
310 IString(unit) +
"] as a unit";
311 throw IException(IException::Programmer, msg, _FILEINFO_);
327 IString msg =
"Angle cannot be a non-Null special pixel";
328 throw IException(IException::Programmer, msg, _FILEINFO_);
347 IString msg =
"Angle can not interpret the enumerated value [" +
348 IString(unit) +
"] as a unit";
349 throw IException(IException::Programmer, msg, _FILEINFO_);
369QDebug operator<<(QDebug dbg,
const Isis::Angle &angleToPrint) {
370 dbg.nospace() << angleToPrint.
radians() <<
" <radians> ("
371 << angleToPrint.
degrees() <<
" <degrees>)";
Defines an angle and provides unit conversions.
bool operator>(const Angle &angle2) const
Test if the other angle is greater than the current angle.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid,...
Angle operator-(const Angle &angle2) const
Subtract angle value from another and return the resulting angle.
virtual ~Angle()
Destroys the angle object.
Angle()
Constructs a blank angle object which needs a value to be set in order to do any calculations.
virtual void setAngle(const double &angle, const Units &unit)
Set angle value in desired units.
bool operator<(const Angle &angle2) const
Test if the other angle is less than the current angle.
double unitWrapValue(const Units &unit) const
Return wrap value in desired units.
double m_radians
The angle measure, always stored in radians.
double radians() const
Convert an angle to a double.
double degrees() const
Get the angle in units of Degrees.
Angle operator*(double value) const
Multiply this angle by a double and return the resulting angle.
static Angle fullRotation()
Makes an angle to represent a full rotation (0-360 or 0-2pi).
Angle operator+(const Angle &angle2) const
Add angle value to another.
Angle operator/(double value) const
Divide this angle by a double.
virtual double angle(const Units &unit) const
Return angle value in desired units.
Units
The set of usable angle measurement units.
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
@ Radians
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
virtual QString toString(bool includeUnits=true) const
Get the angle in human-readable form.
This is free and unencumbered software released into the public domain.
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Angle operator*(double mult, Angle angle)
Multiply this angle by a double and return the resulting angle.