|
mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Functions for basic geometry and working with earth coordinate systems
Macros | |
| #define | semilatrect(a, e) |
| Calculate the semi-latus rectum of a conic section. | |
| #define | focus(a, e) |
| Calculate the focal parameter of a conic section. | |
| #define | semimaj(p, e) |
| #define | eccent(a, p) |
Functions | |
| template<typename realT> | |
| realT | mx::math::dtor (realT q) |
| Convert from degrees to radians. | |
| template<typename realT> | |
| realT | mx::math::rtod (realT q) |
| Convert from radians to degrees. | |
| template<class angleT> | |
| angleT::realT | mx::math::angleMod (typename angleT::realT q) |
| Calculate the angle modulo full-circle, normalizing to a positive value. | |
| template<class angleT> | |
| angleT::realT | mx::math::angleDiff (typename angleT::realT q1, typename angleT::realT q2) |
| Calculate the difference between two angles, correctly across 0/360. | |
| template<class angleT> | |
| angleT::realT | mx::math::angleMean (const std::vector< typename angleT::realT > &q) |
| Calculate the mean of a set of angles, correctly across 0/360. | |
| template<int degrad = 0, typename realT> | |
| int | mx::math::continueAngles (std::vector< realT > &angles, realT threshold=0.75) |
| Make a vector of angles continuous, fixing the 0/360 crossing. | |
| template<typename realT> | |
| void | mx::math::rotatePoint (realT &x0, realT &y0, realT angle) |
| Rotate a point about the origin. | |
| #define eccent | ( | a, | |
| p ) |
Calculate the eccentricity of a conic section given the semi-major axis and the focal parameter
| #define focus | ( | a, | |
| e ) |
Calculate the focal parameter of a conic section.
| #define semilatrect | ( | a, | |
| e ) |
Calculate the semi-latus rectum of a conic section.
| #define semimaj | ( | p, | |
| e ) |
Calculate the semi-major axis of a conic section, given the focal parameter and the eccentricity
| angleT::realT mx::math::angleDiff | ( | typename angleT::realT | q1, |
| typename angleT::realT | q2 ) |
Calculate the difference between two angles, correctly across 0/360.
Calculates \( dq = q2- q1 \), but accounts for crossing 0/360. This implies that \( dq \le 180 \).
| angleT | controls whether this is in degrees (0, default) or radians (1) |
| realT | is the type in which to do arithmetic |
| [in] | q1 | angle to subtract from q2. |
| [in] | q2 | angle to subtract q1 from. |
Definition at line 191 of file geo.hpp.
Referenced by mx::improc::annulusCoordsWorker(), mx::improc::maskWedge(), mx::improc::azBoxKernel< _arrayT, _kernW, _verboseT >::setKernel(), and TEST_CASE().
| angleT::realT mx::math::angleMean | ( | const std::vector< typename angleT::realT > & | q | ) |
Calculate the mean of a set of angles, correctly across 0/360.
Calculates the mean by decomposing into vectors and averaging the components. This accounts for crossing 0/360.
| angleT | is the angle type, either radians<realT> or degrees<realT>. angleT::realT is the type in which to do arithmetic. |
| [in] | q | vector of angles to average. |
Definition at line 226 of file geo.hpp.
Referenced by mx::improc::annulusBoundingRect().
| angleT::realT mx::math::angleMod | ( | typename angleT::realT | q | ) |
Calculate the angle modulo full-circle, normalizing to a positive value.
The output will be betweeen 0 and 360 (or 0 and 2pi).
| degrad | controls whether this is in degrees (0, default) or radians (1) |
| realT | is the type in which to do arithmetic |
| [in] | q | the angle |
Definition at line 164 of file geo.hpp.
Referenced by mx::improc::annulusCoordsWorker(), and TEST_CASE().
| int mx::math::continueAngles | ( | std::vector< realT > & | angles, |
| realT | threshold = 0.75 ) |
Make a vector of angles continuous, fixing the 0/360 crossing.
The vector is modified so it is continuous.
| degrad | controls whether angles are degrees (false) or radians (true) |
| realT | is the type in which to do arithmetic |
| [in] | angles | the vector of angles |
| [in] | threshold | [optional] the fraction of a full circle at which to consider a difference in angle discontinuous. |
Definition at line 255 of file geo.hpp.
References two_pi().
| realT mx::math::dtor | ( | realT | q | ) |
Convert from degrees to radians.
| q | is the angle to convert |
Definition at line 133 of file geo.hpp.
Referenced by mx::improc::azBoxKernel< _arrayT, _kernW, _verboseT >::azBoxKernel(), mx::sigproc::makeModifiedFourierMode(), mx::astro::parAngDeg(), TEST_CASE(), TEST_CASE(), TEST_CASE(), and unitTest::improcTest::imageFiltersTest::TEST_CASE().
| void mx::math::rotatePoint | ( | realT & | x0, |
| realT & | y0, | ||
| realT | angle ) |
Rotate a point about the origin.
The rotation is counter-clockwise for positive angles.
| realT | a real floating point type |
| x0 | [in.out] the x-coordinate of the point to rotate. On exit contains the rotated value. | |
| y0 | [in.out] the y-coordinate of the point to rotate. On exit contains the rotated value. | |
| [in] | angle | the angle by which to rotate [radians] |
| realT mx::math::rtod | ( | realT | q | ) |
Convert from radians to degrees.
| q | is the angle to convert |
Definition at line 148 of file geo.hpp.
Referenced by mx::improc::imCenterRadon< transformT >::center(), mx::improc::maskWedge(), mx::astro::parAngDeg(), and mx::astro::parAngDeg().