Isis 3 Programmer Reference
|
Defines an angle and provides unit conversions. More...
#include <Angle.h>
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. More... | |
Angle (double angle, Units unit) | |
Constructs an angle object with the entered value and unit. More... | |
Angle (const Angle &angle) | |
Constructs an angle object from another Angle object. More... | |
Angle (QString angle) | |
Constructs an angle object with units of Angle::Degrees from a QString of the general form "dd mm ss.ss" (there can be more than 2 digits per piece.) More... | |
virtual | ~Angle () |
Destroys the angle object. More... | |
bool | isValid () const |
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state. More... | |
Angle & | operator= (const Angle &angle2) |
Assign angle object equal to another. More... | |
Angle | operator+ (const Angle &angle2) const |
Add angle value to another. More... | |
Angle | operator- (const Angle &angle2) const |
Subtract angle value from another and return the resulting angle. More... | |
Angle | operator* (double value) const |
Multiply this angle by a double and return the resulting angle. More... | |
Angle | operator/ (double value) const |
Divide this angle by a double. More... | |
double | operator/ (Angle value) const |
Divide this angle by another angle and return the ratio. More... | |
bool | operator< (const Angle &angle2) const |
Test if the other angle is less than the current angle. More... | |
bool | operator> (const Angle &angle2) const |
Test if the other angle is greater than the current angle. More... | |
void | operator+= (const Angle &angle2) |
Add angle value to another as double and replace original. More... | |
void | operator-= (const Angle &angle2) |
Subtract angle value from another and set this instance to the resulting angle. More... | |
Angle | operator* (int value) const |
Multiply this angle by an integer and return the resulting angle. More... | |
void | operator*= (double value) |
Multiply this angle by a double and set this instance to the resulting angle. More... | |
Angle | operator/ (int value) const |
Divide this angle by an integer and return the resulting angle. More... | |
void | operator/= (double value) |
Divide this angle by a double and return the resulting angle. More... | |
bool | operator== (const Angle &angle2) const |
Test if another angle is equal to this angle. More... | |
bool | operator!= (const Angle &angle2) const |
Test if another angle is not equal to this angle. More... | |
bool | operator<= (const Angle &angle2) const |
Test if the other angle is less than or equal to the current angle. More... | |
bool | operator>= (const Angle &angle2) const |
Test if the other angle is greater than or equal to the current angle. More... | |
double | radians () const |
Convert an angle to a double. More... | |
double | degrees () const |
Get the angle in units of Degrees. More... | |
void | setRadians (double radians) |
Set the angle in units of Radians. More... | |
void | setDegrees (double degrees) |
Set the angle in units of Degrees. More... | |
virtual QString | toString (bool includeUnits=true) const |
Get the angle in human-readable form. More... | |
double | unitWrapValue (const Units &unit) const |
Return wrap value in desired units. More... | |
virtual double | angle (const Units &unit) const |
Return angle value in desired units. More... | |
virtual void | setAngle (const double &angle, const Units &unit) |
Set angle value in desired units. More... | |
Static Public Member Functions | |
static Angle | fullRotation () |
Makes an angle to represent a full rotation (0-360 or 0-2pi). More... | |
Private Attributes | |
double | m_radians |
The angle measure, always stored in radians. More... | |
Friends | |
Angle | operator* (double mult, Angle angle) |
Multiply this angle by a double and return the resulting angle. More... | |
Defines an angle and provides unit conversions.
2010-11-01 Steven Lambright - Added methods setRadians and SetDegrees
2012-02-16 Steven Lambright - Brought up to method and member naming standards.
2012-03-22 Steven Lambright - Renamed text() to toString().
2012-06-29 Steven Lambright and Kimberly Oyama - Removed duplicate code from the constructor. Added the fullRotation() method which creates an angle of 360 degrees and modified the unit test to exercise this. References #958.
2012-07-26 Steven Lambright and Kimberly Oyama - Modified the < and > operators to make sure they do not return true if the two operands are the same. Updated the unitTest to exercise this change. References #604.
2013-02-01 Steven Lambright - Added QDebug() printout capabilities. References #1060.
2014-07-28 Kristin Berry - Added a constructor which accepts a Qstring of the form: "dd mm ss.ss" for angles provided in this format.
2014-08-21 Jeannie Backer - Modified isValid to utilize the IsValidPixel() method in the SpecialPixel header. References #1659.
2017-07-03 Makayla Shepherd - Updated documentation. References #4807.
2018-11-13 Kristin Berry - Made protected methods public as part of testing refactor.
2019-03-11 Kaitlyn Lee - Added comments to > and < operators to clarify why the != comparison was needed.
enum Isis::Angle::Units |
The set of usable angle measurement units.
Isis::Angle::Angle | ( | ) |
Constructs a blank angle object which needs a value to be set in order to do any calculations.
Definition at line 38 of file Angle.cpp.
References m_radians, and Isis::Null.
Referenced by Isis::Longitude::force180Domain(), fullRotation(), operator*(), operator+(), operator-(), operator/(), Isis::Latitude::planetographic(), Isis::Latitude::setAngle(), and Isis::Latitude::setPlanetographic().
Isis::Angle::Angle | ( | double | angle, |
Units | unit | ||
) |
Constructs an angle object with the entered value and unit.
angle | The initial angle value in units of the unit parameter |
unit | The unit of the initial angle (see Angle::Units) |
Definition at line 48 of file Angle.cpp.
References angle(), and setAngle().
Isis::Angle::Angle | ( | const Angle & | fromAngle | ) |
Isis::Angle::Angle | ( | QString | angle | ) |
Constructs an angle object with units of Angle::Degrees from a QString of the general form "dd mm ss.ss" (there can be more than 2 digits per piece.)
angle | The value of the angle in degrees, as a QString of the form: "dd mm ss.ss" |
Definition at line 69 of file Angle.cpp.
References _FILEINFO_, angle(), Degrees, degrees(), Isis::IException::Programmer, and setAngle().
|
virtual |
Destroys the angle object.
Definition at line 98 of file Angle.cpp.
References m_radians, and Isis::Null.
|
virtual |
Return angle value in desired units.
unit | Desired units of the angle (see Angle::Units) |
Definition at line 304 of file Angle.cpp.
References _FILEINFO_, Degrees, m_radians, Isis::Null, Isis::IException::Programmer, Isis::RAD2DEG, and Radians.
Referenced by Angle(), degrees(), Isis::Longitude::force360Domain(), operator<(), operator==(), operator>(), Isis::Latitude::planetocentric(), Isis::Longitude::positiveEast(), Isis::Longitude::positiveWest(), radians(), Isis::Latitude::setAngle(), and setAngle().
|
inline |
Get the angle in units of Degrees.
Definition at line 249 of file Angle.h.
References angle(), and Degrees.
Referenced by Angle(), Isis::MosaicGridTool::autoGrid(), Isis::PhotometricFunction::compute(), Isis::ControlPointEditWidget::createTemporaryGroundMeasure(), Isis::MosaicGridTool::drawGrid(), Isis::QnetSetAprioriDialog::fillAverageAprioriLineEdits(), Isis::QnetSetAprioriDialog::fillCurrentAprioriLineEdits(), Isis::QnetSetAprioriDialog::fillReferenceAprioriLineEdits(), Isis::QnetTool::findPointLocation(), Isis::Longitude::force180Domain(), Isis::Longitude::force360Domain(), Isis::BundleControlPoint::formatBundleLatitudinalOutputDetailString(), Isis::BundleTargetBody::formatBundleOutputString(), Isis::ImageTreeWidgetItem::ImageTreeWidgetItem(), Isis::DemShape::localRadius(), operator<<(), Isis::ControlNetFilter::PointLatLonFilter(), Isis::MosaicGridToolConfigDialog::readSettings(), Isis::MosaicGridToolConfigDialog::refreshWidgetStates(), Isis::FeatureNomenclature::runQuery(), Isis::Latitude::setAngle(), setDegrees(), Isis::VimsGroundMap::SetGround(), Isis::UniversalGroundMap::SetGround(), Isis::CameraGroundMap::SetGround(), Isis::Camera::SetGround(), Isis::ControlPointEditWidget::setShapesForPoint(), Isis::BundleTargetBody::setSolveSettings(), Isis::UniversalGroundMap::SetUnboundGround(), Isis::RingPlaneProjection::To180Domain(), Isis::TProjection::To180Domain(), Isis::RingPlaneProjection::To360Domain(), Isis::TProjection::To360Domain(), Isis::MosaicGridTool::toPvl(), Isis::ControlNetVersioner::toPvl(), toString(), Isis::Sensor::UniversalLatitude(), Isis::Sensor::UniversalLongitude(), Isis::BundleControlPoint::updateAdjustedSurfacePointLatitudinally(), Isis::MeasureTool::updateDist(), Isis::SunShadowTool::updateRow(), Isis::AdvancedTrackTool::updateRow(), Isis::ControlPointEditWidget::updateSurfacePointInfo(), and Isis::QnetTool::updateSurfacePointInfo().
|
static |
Makes an angle to represent a full rotation (0-360 or 0-2pi).
Definition at line 121 of file Angle.cpp.
References Angle(), and Degrees.
Referenced by Isis::Hillshade::shadedValue(), and Isis::Longitude::to360Range().
bool Isis::Angle::isValid | ( | ) | const |
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
Definition at line 110 of file Angle.cpp.
References m_radians, and Isis::Null.
Referenced by Isis::FeatureNomenclatureTool::FeaturePosition::applyExtentType(), Isis::GroundGrid::CreateGrid(), Isis::Longitude::force180Domain(), Isis::Longitude::force360Domain(), Isis::UniversalGroundMap::GroundRange(), Isis::DemShape::localRadius(), Isis::SunShadowTool::mouseMove(), operator*(), operator+(), operator-(), operator/(), operator<(), operator>(), Isis::Latitude::planetographic(), Isis::NaifDskPlateModel::point(), Isis::Shape::save(), Isis::Image::save(), Isis::ControlPoint::SetAprioriSurfacePoint(), Isis::Hillshade::setAzimuth(), Isis::GroundGrid::SetGroundLimits(), Isis::Camera::SetImageMapProjection(), Isis::SurfacePoint::SetSpherical(), Isis::SurfacePoint::SetSphericalPoint(), Isis::SurfacePoint::SetSphericalSigmas(), Isis::Hillshade::setZenith(), Isis::Longitude::to360Range(), toString(), and Isis::SunShadowTool::updateRow().
|
inline |
Angle Isis::Angle::operator* | ( | double | value | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
Angle Isis::Angle::operator/ | ( | double | value | ) | const |
double Isis::Angle::operator/ | ( | Angle | value | ) | const |
Divide this angle by another angle and return the ratio.
value | The ratio, Null if invalid |
Definition at line 209 of file Angle.cpp.
References isValid(), Isis::Null, and radians().
|
inline |
|
inline |
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.
angle2 | The comparison angle (on right-hand-side of < operator) |
Definition at line 223 of file Angle.cpp.
References _FILEINFO_, angle(), isValid(), Isis::IException::Programmer, and Radians.
|
inline |
Assign angle object equal to another.
angle2 | The angle value to copy |
Definition at line 100 of file Angle.h.
References Radians, radians(), and setAngle().
|
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.
angle2 | The comparison angle (on right-hand-side of == operator) |
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.
angle2 | The comparison angle (on right-hand-side of > operator) |
Definition at line 241 of file Angle.cpp.
References _FILEINFO_, angle(), isValid(), Isis::IException::Programmer, and Radians.
|
inline |
|
inline |
Convert an angle to a double.
This will return the radians version of the angle.
operator double() const { return angle(Radians); } Get the angle in units of Radians.
Definition at line 243 of file Angle.h.
References angle(), and Radians.
Referenced by Isis::Latitude::add(), Isis::MosaicAreaTool::calcLatLonRange(), Isis::CameraGroundMap::EllipsoidPartial(), Isis::SurfacePoint::GetDistanceToPoint(), Isis::Camera::GetLocalNormal(), Isis::Longitude::inRange(), Isis::Latitude::Latitude(), Isis::EmbreeShapeModel::latlonToRay(), Isis::BulletShapeModel::latlonToVector(), Isis::EllipsoidShape::localRadius(), Isis::BundleTargetBody::localRadius(), Isis::Longitude::Longitude(), Isis::SunShadowTool::mouseMove(), operator*(), operator+(), operator-(), operator/(), operator<<(), operator=(), Isis::FeatureNomenclatureTool::ViewportFeatureDisplay::paint(), Isis::Latitude::planetographic(), Isis::CameraGroundMap::PointPartial(), Isis::LinearAlgebra::rotate(), Isis::Shape::save(), Isis::Image::save(), Isis::SpiceRotation::setEphemerisTimePckPolyFunction(), Isis::VimsGroundMap::SetGround(), Isis::Latitude::setPlanetographic(), setRadians(), Isis::BundleTargetBody::setSolveSettings(), Isis::SurfacePoint::SetSphericalPoint(), Isis::SurfacePoint::SetSphericalSigmas(), Isis::Hillshade::shadedValue(), Isis::MeasureTool::updateDist(), and Isis::SunShadowTool::updateRow().
|
virtual |
Set angle value in desired units.
angle | The angle value in units of the unit parameter |
unit | Desired units of the angle (see Angle::Units) |
Reimplemented in Isis::Latitude.
Definition at line 338 of file Angle.cpp.
References _FILEINFO_, angle(), Isis::DEG2RAD, Degrees, Isis::IsSpecial(), m_radians, Isis::Null, Isis::IException::Programmer, and Radians.
Referenced by Angle(), operator=(), Isis::Latitude::setAngle(), setDegrees(), Isis::Longitude::setPositiveEast(), Isis::Longitude::setPositiveWest(), and setRadians().
|
inline |
Set the angle in units of Degrees.
degrees | The new angle value, Null for invalid angle |
Definition at line 263 of file Angle.h.
References Degrees, degrees(), and setAngle().
|
inline |
Set the angle in units of Radians.
radians | The new angle value, Null for invalid angle |
Definition at line 256 of file Angle.h.
References Radians, radians(), and setAngle().
Referenced by Isis::LinearAlgebra::toAxisAngle(), and Isis::LinearAlgebra::toEulerAngles().
|
virtual |
Get the angle in human-readable form.
includeUnits | Include the angle's units in the text. |
Definition at line 258 of file Angle.cpp.
References degrees(), isValid(), and Isis::toString().
Referenced by Isis::Latitude::inRange(), Isis::Latitude::Latitude(), Isis::operator<<(), Isis::Latitude::planetographic(), and Isis::Hillshade::shadedValue().
double Isis::Angle::unitWrapValue | ( | const Units & | unit | ) | const |
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.
unit | Desired units of the Angle wrap constant (see Angle::Units) |
Definition at line 281 of file Angle.cpp.
References _FILEINFO_, Degrees, Isis::PI, Isis::IException::Programmer, and Radians.
Referenced by Isis::Longitude::positiveWest(), and Isis::Longitude::setPositiveWest().
|
private |