#include <Angle.h>
Public Member Functions | |
Angle () | |
Angle (double dx, double dy) | |
Angle (double dx, double dy, double r) | |
void | chSign () |
double | cos () const |
double | cotan () const |
double | degrees () const |
void | initDegrees () |
void | initRadians () |
bool | isNull () const |
void | mirror () |
void | normalize () |
void | operator+= (const Angle &o) |
bool | operator< (const Angle &o) const |
Angle & | operator= (const Angle &o) |
bool | operator== (const Angle &o) const |
double | radians () const |
void | set (double dx, double dy) |
void | set (double dx, double dy, double r) |
void | setDegreeAzimuth (double azimuth) |
void | setDegrees (double degrees) |
void | setRadianAzimuth (double azimuth) |
void | setRadians (double radians) |
double | sin () const |
double | tan () const |
~Angle () | |
Static Public Member Functions | |
static double | degreesToDM (double angle) |
static double | degreesToDMS (double angle) |
static double | degreesToRadians (double angle) |
static double | DMSToDegrees (double angle) |
static double | DMToDegrees (double angle) |
static double | geographicToMath (double angle) |
static double | mathToGeographic (double angle) |
static double | radiansToDegrees (double angle) |
QGpCoreTools::Angle::Angle | ( | ) | [inline] |
QGpCoreTools::Angle::Angle | ( | double | dx, |
double | dy | ||
) | [inline] |
{set(dx, dy);}
QGpCoreTools::Angle::Angle | ( | double | dx, |
double | dy, | ||
double | r | ||
) | [inline] |
{set(dx,dy,r);}
QGpCoreTools::Angle::~Angle | ( | ) | [inline] |
{}
void QGpCoreTools::Angle::chSign | ( | ) | [inline] |
double QGpCoreTools::Angle::cos | ( | ) | const [inline] |
Referenced by ArrayCore::HRFK::crossCorrelationMatrix(), ArrayCore::StationCoupleProcess::horizontalAutocorr(), QGpCoreTools::Point::move(), QGpCoreTools::Point2D::move(), EllipseItem::nodes(), CoordReader::parse(), QGpCoreTools::Point2D::rotate(), QGpCoreTools::DoubleMatrix::rotation(), ArrayGui::ArrayResponse::setAzimuth(), setDegrees(), CoordReader::setOptions(), setRadians(), PtMotionResults::updateSignals(), QGpCoreWave::TheoreticalLinearFK::value(), QGpCoreTools::Ellipse::xRadius(), and QGpCoreTools::Ellipse::yRadius().
{return _cos;}
double QGpCoreTools::Angle::cotan | ( | ) | const [inline] |
{return _cos/_sin;}
double QGpCoreTools::Angle::degrees | ( | ) | const [inline] |
double QGpCoreTools::Angle::degreesToDM | ( | double | angle | ) | [static] |
Converts from degrees to D.MMmm... (degrees, minutes).
{ double sign; if(angle<0.0) { sign=-1.0; angle=-angle; } else { sign=1.0; } double d=floor(angle); angle=(angle-d)*60.0; d+=0.01*angle; return sign*d; }
double QGpCoreTools::Angle::degreesToDMS | ( | double | angle | ) | [static] |
Converts from degrees to D.MMSSsss... (degrees, minutes, seconds).
{ double sign; if(angle<0.0) { sign=-1.0; angle=-angle; } else { sign=1.0; } double d=floor(angle); angle=(angle-d)*60.0; double m=floor(angle); angle=(angle-m)*60.0; d+=0.01*m+0.0001*angle; return sign*d; }
double QGpCoreTools::Angle::degreesToRadians | ( | double | angle | ) | [inline, static] |
Referenced by QGpCoreTools::PointLocate::fromString(), QGpCoreTools::Point2D::geographicalAzimuthTo(), QGpCoreTools::Point2D::geographicalDistanceTo(), QGpCoreTools::Point2D::geographicalToUtm(), geographicToMath(), setDegrees(), and QGpCoreTools::Point2D::utmToGeographical().
{
return angle*M_PI/180.0;
}
double QGpCoreTools::Angle::DMSToDegrees | ( | double | angle | ) | [static] |
Converts from D.MMSSsss... (degrees, minutes, seconds) to degrees.
{ double sign; if(angle<0.0) { sign=-1.0; angle=-angle; } else { sign=1.0; } double d=floor(angle); angle=(angle-d)*100.0; double m=floor(angle); angle=(angle-m)*100.0; d+=m/60.0+angle/3600.0; return sign*d; }
double QGpCoreTools::Angle::DMToDegrees | ( | double | angle | ) | [static] |
Converts from D.MMSSsss... (degrees, minutes) to degrees.
{ double sign; if(angle<0.0) { sign=-1.0; angle=-angle; } else { sign=1.0; } double d=floor(angle); angle=(angle-d)*100.0; d+=angle/60.0; return sign*d; }
double QGpCoreTools::Angle::geographicToMath | ( | double | angle | ) | [inline, static] |
Converts a geographical azimuth in degrees (0 in north direction, clockwize) to an angle in radians in mathematical sense (0 in east direction, anti-clockwize).
References degreesToRadians().
{ angle=degreesToRadians(angle); return angle<=0.5*M_PI ? 0.5*M_PI-angle : 2.5*M_PI-angle; }
void QGpCoreTools::Angle::initDegrees | ( | ) | [inline] |
From angle in radians, compute angle in degrees
References radiansToDegrees(), and TRACE.
Referenced by QGpCoreTools::Ellipse::setOrientation(), and ArrayCore::StationCouple::setStations().
{ TRACE; _deg=radiansToDegrees(_rad); }
void QGpCoreTools::Angle::initRadians | ( | ) | [inline] |
From cosine and sine of angle, compute angle in radians from -pi/2 to pi/2
References TRACE.
Referenced by SciFigs::SlopeEstimator::paintData(), SciFigs::SlopeEstimator::paintText(), and ArrayCore::StationCouple::setStations().
{ TRACE; _rad=::atan2(_sin, _cos); }
bool QGpCoreTools::Angle::isNull | ( | ) | const [inline] |
Referenced by SciFigs::CircleViewer::paintData().
{return _rad==0.0;}
double QGpCoreTools::Angle::mathToGeographic | ( | double | angle | ) | [inline, static] |
Converts an angle in radians in mathematical sense (0 in east direction, anti-clockwize) to geographical azimuth in degrees (0 in north direction, clockwize).
References radiansToDegrees().
{ angle=radiansToDegrees(angle); return angle<=90.0 ? 90.0-angle : 450.0-angle; }
void QGpCoreTools::Angle::mirror | ( | ) | [inline] |
Rotate angle by 180 degrees
References TRACE.
Referenced by ArrayCore::StationCouple::setStations().
{ TRACE; _cos=-_cos; _sin=-_sin; if(_deg>180.0) _deg-=180; else _deg+=180.0; if(_rad>M_PI) _rad-=M_PI; else _rad+=M_PI; }
void QGpCoreTools::Angle::normalize | ( | ) |
Maintains degrees and radians between 0 and 360, 0 and 2*pi, respectivelly.
Referenced by PtMotionResults::updateSignals().
{ while(_deg>=360.0) _deg-=360.0; while(_deg<0.0) _deg+=360.0; while(_rad>=2.0*M_PI) _rad-=2.0*M_PI; while(_rad<0.0) _rad+=2.0*M_PI; }
void QGpCoreTools::Angle::operator+= | ( | const Angle & | o | ) |
References setRadians().
{ _deg+=a._deg; setRadians(_rad+a._rad); }
bool QGpCoreTools::Angle::operator< | ( | const Angle & | o | ) | const [inline] |
{return _rad<o._rad;}
bool QGpCoreTools::Angle::operator== | ( | const Angle & | o | ) | const [inline] |
{return _rad==o._rad;}
double QGpCoreTools::Angle::radians | ( | ) | const [inline] |
Referenced by setRadians(), and QGpCoreTools::Ellipse::yRadius().
{return _rad;}
double QGpCoreTools::Angle::radiansToDegrees | ( | double | angle | ) | [inline, static] |
Referenced by initDegrees(), mathToGeographic(), QGpCoreTools::PointLocate::toString(), and QGpCoreTools::Point2D::utmToGeographical().
{
return angle*180.0/M_PI;
}
void QGpCoreTools::Angle::set | ( | double | dx, |
double | dy | ||
) | [inline] |
Set cosine and sine with compution of distance (sqrt(dx*dx+dy*dy))
References QGpCoreTools::sqrt(), and TRACE.
Referenced by ArrayCore::StationCouple::setStations().
void QGpCoreTools::Angle::set | ( | double | dx, |
double | dy, | ||
double | r | ||
) | [inline] |
void QGpCoreTools::Angle::setDegreeAzimuth | ( | double | azimuth | ) | [inline] |
Referenced by ArrayCore::HRFK::crossCorrelationMatrix(), ArrayCore::FKHorizontal::FKHorizontal(), CoordReader::parse(), and CoordReader::setOptions().
{setDegrees(90.0-azimuth);}
void QGpCoreTools::Angle::setDegrees | ( | double | degrees | ) | [inline] |
Can access angle in degrees, radians, sine or cosine.
References cos(), degrees(), degreesToRadians(), sin(), and TRACE.
Referenced by GeopsyCore::RotateParameters::matrix(), EllipseItem::nodes(), SciFigs::NameLineLayer::paintData(), CoordReader::setOptions(), and PtMotionResults::updateSignals().
{ TRACE; _deg=degrees; _rad=degreesToRadians(_deg); _cos=::cos(_rad); _sin=::sin(_rad); }
void QGpCoreTools::Angle::setRadianAzimuth | ( | double | azimuth | ) | [inline] |
Referenced by TapePositioningSystem::Cluster::setCoordinateSystem().
{setRadians(0.5*M_PI-azimuth);}
void QGpCoreTools::Angle::setRadians | ( | double | radians | ) | [inline] |
Degrees are not set, only angle in radians, sine or cosine. To be able to call degrees(), call initDegrees() before.
References cos(), radians(), sin(), and TRACE.
Referenced by operator+=(), and QGpCoreTools::Ellipse::setOrientation().
double QGpCoreTools::Angle::sin | ( | ) | const [inline] |
Referenced by ArrayCore::HRFK::crossCorrelationMatrix(), ArrayCore::StationCoupleProcess::horizontalAutocorr(), QGpCoreTools::Point::move(), QGpCoreTools::Point2D::move(), EllipseItem::nodes(), CoordReader::parse(), QGpCoreTools::Point2D::rotate(), QGpCoreTools::DoubleMatrix::rotation(), ArrayGui::ArrayResponse::setAzimuth(), setDegrees(), CoordReader::setOptions(), setRadians(), ArrayCore::StationCouple::setStations(), PtMotionResults::updateSignals(), QGpCoreWave::TheoreticalLinearFK::value(), QGpCoreTools::Ellipse::xRadius(), and QGpCoreTools::Ellipse::yRadius().
{return _sin;}
double QGpCoreTools::Angle::tan | ( | ) | const [inline] |
Referenced by QGpCoreTools::Ellipse::xRadius(), and QGpCoreTools::Ellipse::yRadius().
{return _sin/_cos;}