| Geodesic.hpp | | Geodesic.hpp | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| * relation, \e m12 + \e m21 = 0. On a flat surface, we have \e m12 =
\e | | * relation, \e m12 + \e m21 = 0. On a flat surface, we have \e m12 =
\e | |
| * s12. The ratio <i>s12</i>/\e m12 gives the azimuthal scale for an | | * s12. The ratio <i>s12</i>/\e m12 gives the azimuthal scale for an | |
| * azimuthal equidistant projection. | | * azimuthal equidistant projection. | |
| * - <i>geodesic scale</i>. Consider a reference geodesic and a second | | * - <i>geodesic scale</i>. Consider a reference geodesic and a second | |
| * geodesic parallel to this one at point 1 and separated by a small | | * geodesic parallel to this one at point 1 and separated by a small | |
| * distance \e dt. The separation of the two geodesics at point 2 is \
e | | * distance \e dt. The separation of the two geodesics at point 2 is \
e | |
| * M12 \e dt where \e M12 is called the "geodesic scale". \e M21 is | | * M12 \e dt where \e M12 is called the "geodesic scale". \e M21 is | |
| * defined similarly (with the geodesics being parallel at point 2). O
n a | | * defined similarly (with the geodesics being parallel at point 2). O
n a | |
| * flat surface, we have \e M12 = \e M21 = 1. The quantity 1/\e M12 gi
ves | | * flat surface, we have \e M12 = \e M21 = 1. The quantity 1/\e M12 gi
ves | |
| * the scale of the Cassini-Soldner projection. | | * the scale of the Cassini-Soldner projection. | |
|
| | | | |
| * - <i>area</i>. The area between the geodesic from point 1 to point 2
and | | * - <i>area</i>. The area between the geodesic from point 1 to point 2
and | |
| * the equation is represented by \e S12; it is the area, measured | | * the equation is represented by \e S12; it is the area, measured | |
| * counter-clockwise, of the geodesic quadrilateral with corners | | * counter-clockwise, of the geodesic quadrilateral with corners | |
| * (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), (0,<i>lon2</i>), and | | * (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), (0,<i>lon2</i>), and | |
| * (<i>lat2</i>,<i>lon2</i>). It can be used to compute the area of an
y | | * (<i>lat2</i>,<i>lon2</i>). It can be used to compute the area of an
y | |
| * simple geodesic polygon. | | * simple geodesic polygon. | |
| * | | * | |
| * Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and | | * Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and | |
| * Geodesic::Inverse allow these quantities to be returned. In addition | | * Geodesic::Inverse allow these quantities to be returned. In addition | |
| * there are general functions Geodesic::GenDirect, and Geodesic::GenInve
rse | | * there are general functions Geodesic::GenDirect, and Geodesic::GenInve
rse | |
| | | | |
| skipping to change at line 199 | | skipping to change at line 198 | |
| real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_; | | real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_; | |
| | | | |
| enum captype { | | enum captype { | |
| CAP_NONE = 0U, | | CAP_NONE = 0U, | |
| CAP_C1 = 1U<<0, | | CAP_C1 = 1U<<0, | |
| CAP_C1p = 1U<<1, | | CAP_C1p = 1U<<1, | |
| CAP_C2 = 1U<<2, | | CAP_C2 = 1U<<2, | |
| CAP_C3 = 1U<<3, | | CAP_C3 = 1U<<3, | |
| CAP_C4 = 1U<<4, | | CAP_C4 = 1U<<4, | |
| CAP_ALL = 0x1FU, | | CAP_ALL = 0x1FU, | |
|
| | | CAP_MASK = CAP_ALL, | |
| OUT_ALL = 0x7F80U, | | OUT_ALL = 0x7F80U, | |
|
| | | OUT_MASK = 0xFF80U, // Includes LONG_NOWRAP | |
| }; | | }; | |
| | | | |
| static real SinCosSeries(bool sinp, | | static real SinCosSeries(bool sinp, | |
| real sinx, real cosx, const real c[], int n); | | real sinx, real cosx, const real c[], int n); | |
| static inline real AngRound(real x) { | | static inline real AngRound(real x) { | |
| // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^
57 | | // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^
57 | |
| // for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi
s | | // for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi
s | |
| // is about 1000 times more resolution than we get with angles around
90 | | // is about 1000 times more resolution than we get with angles around
90 | |
| // degrees.) We use this to avoid having to deal with near singular | | // degrees.) We use this to avoid having to deal with near singular | |
| // cases when x is non-zero but tiny (e.g., 1.0e-200). | | // cases when x is non-zero but tiny (e.g., 1.0e-200). | |
| | | | |
| skipping to change at line 325 | | skipping to change at line 326 | |
| * Calculate geodesic scales \e M12 and \e M21. | | * Calculate geodesic scales \e M12 and \e M21. | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| GEODESICSCALE = 1U<<13 | CAP_C1 | CAP_C2, | | GEODESICSCALE = 1U<<13 | CAP_C1 | CAP_C2, | |
| /** | | /** | |
| * Calculate area \e S12. | | * Calculate area \e S12. | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| AREA = 1U<<14 | CAP_C4, | | AREA = 1U<<14 | CAP_C4, | |
| /** | | /** | |
|
| * All capabilities, calculate everything. | | * Do not wrap the \e lon2 in the direct calculation. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LONG_NOWRAP = 1U<<15, | |
| | | /** | |
| | | * All capabilities, calculate everything. (LONG_NOWRAP is not | |
| | | * included in this mask.) | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| ALL = OUT_ALL| CAP_ALL, | | ALL = OUT_ALL| CAP_ALL, | |
| }; | | }; | |
| | | | |
| /** \name Constructor | | /** \name Constructor | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| ///@{ | | ///@{ | |
| /** | | /** | |
| * Constructor for a ellipsoid with | | * Constructor for a ellipsoid with | |
| | | | |
| skipping to change at line 623 | | skipping to change at line 630 | |
| * The Geodesic::mask values possible for \e outmask are | | * The Geodesic::mask values possible for \e outmask are | |
| * - \e outmask |= Geodesic::LATITUDE for the latitude \e lat2; | | * - \e outmask |= Geodesic::LATITUDE for the latitude \e lat2; | |
| * - \e outmask |= Geodesic::LONGITUDE for the latitude \e lon2; | | * - \e outmask |= Geodesic::LONGITUDE for the latitude \e lon2; | |
| * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2; | | * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2; | |
| * - \e outmask |= Geodesic::DISTANCE for the distance \e s12; | | * - \e outmask |= Geodesic::DISTANCE for the distance \e s12; | |
| * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e | | * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e | |
| * m12; | | * m12; | |
| * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e | | * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e | |
| * M12 and \e M21; | | * M12 and \e M21; | |
| * - \e outmask |= Geodesic::AREA for the area \e S12; | | * - \e outmask |= Geodesic::AREA for the area \e S12; | |
|
| * - \e outmask |= Geodesic::ALL for all of the above. | | * - \e outmask |= Geodesic::ALL for all of the above; | |
| | | * - \e outmask |= Geodesic::LONG_NOWRAP stops the returned value of \e | |
| | | * lon2 being wrapped into the range [−180°, 180°). | |
| * . | | * . | |
| * The function value \e a12 is always computed and returned and this | | * The function value \e a12 is always computed and returned and this | |
| * equals \e s12_a12 is \e arcmode is true. If \e outmask includes | | * equals \e s12_a12 is \e arcmode is true. If \e outmask includes | |
| * Geodesic::DISTANCE and \e arcmode is false, then \e s12 = \e s12_a12
. | | * Geodesic::DISTANCE and \e arcmode is false, then \e s12 = \e s12_a12
. | |
| * It is not necessary to include Geodesic::DISTANCE_IN in \e outmask;
this | | * It is not necessary to include Geodesic::DISTANCE_IN in \e outmask;
this | |
| * is automatically included is \e arcmode is false. | | * is automatically included is \e arcmode is false. | |
|
| | | * | |
| | | * With the LONG_NOWRAP bit set, the quantity \e lon2 − \e lon1 | |
| | | * indicates how many times the geodesic wrapped around the ellipsoid. | |
| | | * Because \e lon2 might be outside the normal allowed range for | |
| | | * longitudes, [−540°, 540°), be sure to normalize it wit | |
| | | h | |
| | | * Math::AngNormalize2 before using it in other GeographicLib calls. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real GenDirect(real lat1, real lon1, real azi1, | | Math::real GenDirect(real lat1, real lon1, real azi1, | |
| bool arcmode, real s12_a12, unsigned outmask, | | bool arcmode, real s12_a12, unsigned outmask, | |
| real& lat2, real& lon2, real& azi2, | | real& lat2, real& lon2, real& azi2, | |
| real& s12, real& m12, real& M12, real& M21, | | real& s12, real& m12, real& M12, real& M21, | |
| real& S12) const; | | real& S12) const; | |
| ///@} | | ///@} | |
| | | | |
| /** \name Inverse geodesic problem. | | /** \name Inverse geodesic problem. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| | | | |
End of changes. 6 change blocks. |
| 3 lines changed or deleted | | 20 lines changed or added | |
|
| GeodesicLine.hpp | | GeodesicLine.hpp | |
| /** | | /** | |
| * \file GeodesicLine.hpp | | * \file GeodesicLine.hpp | |
| * \brief Header for GeographicLib::GeodesicLine class | | * \brief Header for GeographicLib::GeodesicLine class | |
| * | | * | |
|
| * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licens
ed | | * Copyright (c) Charles Karney (2009-2014) <charles@karney.com> and licens
ed | |
| * under the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) | | #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) | |
| #define GEOGRAPHICLIB_GEODESICLINE_HPP 1 | | #define GEOGRAPHICLIB_GEODESICLINE_HPP 1 | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/Geodesic.hpp> | | #include <GeographicLib/Geodesic.hpp> | |
| | | | |
| | | | |
| skipping to change at line 87 | | skipping to change at line 87 | |
| unsigned _caps; | | unsigned _caps; | |
| | | | |
| enum captype { | | enum captype { | |
| CAP_NONE = Geodesic::CAP_NONE, | | CAP_NONE = Geodesic::CAP_NONE, | |
| CAP_C1 = Geodesic::CAP_C1, | | CAP_C1 = Geodesic::CAP_C1, | |
| CAP_C1p = Geodesic::CAP_C1p, | | CAP_C1p = Geodesic::CAP_C1p, | |
| CAP_C2 = Geodesic::CAP_C2, | | CAP_C2 = Geodesic::CAP_C2, | |
| CAP_C3 = Geodesic::CAP_C3, | | CAP_C3 = Geodesic::CAP_C3, | |
| CAP_C4 = Geodesic::CAP_C4, | | CAP_C4 = Geodesic::CAP_C4, | |
| CAP_ALL = Geodesic::CAP_ALL, | | CAP_ALL = Geodesic::CAP_ALL, | |
|
| | | CAP_MASK = Geodesic::CAP_MASK, | |
| OUT_ALL = Geodesic::OUT_ALL, | | OUT_ALL = Geodesic::OUT_ALL, | |
|
| | | OUT_MASK = Geodesic::OUT_MASK, | |
| }; | | }; | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Bit masks for what calculations to do. They signify to the | | * Bit masks for what calculations to do. They signify to the | |
| * GeodesicLine::GeodesicLine constructor and to Geodesic::Line what | | * GeodesicLine::GeodesicLine constructor and to Geodesic::Line what | |
| * capabilities should be included in the GeodesicLine object. This is | | * capabilities should be included in the GeodesicLine object. This is | |
| * merely a duplication of Geodesic::mask. | | * merely a duplication of Geodesic::mask. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| enum mask { | | enum mask { | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 150 | |
| * Calculate geodesic scales \e M12 and \e M21. | | * Calculate geodesic scales \e M12 and \e M21. | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| GEODESICSCALE = Geodesic::GEODESICSCALE, | | GEODESICSCALE = Geodesic::GEODESICSCALE, | |
| /** | | /** | |
| * Calculate area \e S12. | | * Calculate area \e S12. | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| AREA = Geodesic::AREA, | | AREA = Geodesic::AREA, | |
| /** | | /** | |
|
| * All capabilities, calculate everything. | | * Do not wrap \e lon2 in the direct calculation. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LONG_NOWRAP = Geodesic::LONG_NOWRAP, | |
| | | /** | |
| | | * All capabilities, calculate everything. (LONG_NOWRAP is not | |
| | | * included in this mask.) | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| ALL = Geodesic::ALL, | | ALL = Geodesic::ALL, | |
| }; | | }; | |
| | | | |
| /** \name Constructors | | /** \name Constructors | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| ///@{ | | ///@{ | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 496 | | skipping to change at line 504 | |
| * The GeodesicLine::mask values possible for \e outmask are | | * The GeodesicLine::mask values possible for \e outmask are | |
| * - \e outmask |= GeodesicLine::LATITUDE for the latitude \e lat2; | | * - \e outmask |= GeodesicLine::LATITUDE for the latitude \e lat2; | |
| * - \e outmask |= GeodesicLine::LONGITUDE for the latitude \e lon2; | | * - \e outmask |= GeodesicLine::LONGITUDE for the latitude \e lon2; | |
| * - \e outmask |= GeodesicLine::AZIMUTH for the latitude \e azi2; | | * - \e outmask |= GeodesicLine::AZIMUTH for the latitude \e azi2; | |
| * - \e outmask |= GeodesicLine::DISTANCE for the distance \e s12; | | * - \e outmask |= GeodesicLine::DISTANCE for the distance \e s12; | |
| * - \e outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length \
e | | * - \e outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length \
e | |
| * m12; | | * m12; | |
| * - \e outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales
\e | | * - \e outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales
\e | |
| * M12 and \e M21; | | * M12 and \e M21; | |
| * - \e outmask |= GeodesicLine::AREA for the area \e S12; | | * - \e outmask |= GeodesicLine::AREA for the area \e S12; | |
|
| * - \e outmask |= GeodesicLine::ALL for all of the above. | | * - \e outmask |= GeodesicLine::ALL for all of the above; | |
| | | * - \e outmask |= GeodesicLine::LONG_NOWRAP stops the returned value o | |
| | | f \e | |
| | | * lon2 being wrapped into the range [−180°, 180°). | |
| * . | | * . | |
| * Requesting a value which the GeodesicLine object is not capable of | | * Requesting a value which the GeodesicLine object is not capable of | |
| * computing is not an error; the corresponding argument will not be | | * computing is not an error; the corresponding argument will not be | |
| * altered. Note, however, that the arc length is always computed and | | * altered. Note, however, that the arc length is always computed and | |
| * returned as the function value. | | * returned as the function value. | |
|
| | | * | |
| | | * With the LONG_NOWRAP bit set, the quantity \e lon2 − \e lon1 | |
| | | * indicates how many times the geodesic wrapped around the ellipsoid. | |
| | | * Because \e lon2 might be outside the normal allowed range for | |
| | | * longitudes, [−540°, 540°), be sure to normalize it wit | |
| | | h | |
| | | * Math::AngNormalize2 before using it in other GeographicLib calls. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, | | Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, | |
| real& lat2, real& lon2, real& azi2, | | real& lat2, real& lon2, real& azi2, | |
| real& s12, real& m12, real& M12, real& M21, | | real& s12, real& m12, real& M12, real& M21, | |
| real& S12) const; | | real& S12) const; | |
| | | | |
| ///@} | | ///@} | |
| | | | |
| /** \name Inspector functions | | /** \name Inspector functions | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| | | | |
End of changes. 6 change blocks. |
| 3 lines changed or deleted | | 22 lines changed or added | |
|
| GeodesicLineExact.hpp | | GeodesicLineExact.hpp | |
| /** | | /** | |
| * \file GeodesicLineExact.hpp | | * \file GeodesicLineExact.hpp | |
| * \brief Header for GeographicLib::GeodesicLineExact class | | * \brief Header for GeographicLib::GeodesicLineExact class | |
| * | | * | |
|
| * Copyright (c) Charles Karney (2012) <charles@karney.com> and licensed un | | * Copyright (c) Charles Karney (2012-2014) <charles@karney.com> and licens | |
| der | | ed | |
| * the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEODESICLINEEXACT_HPP) | | #if !defined(GEOGRAPHICLIB_GEODESICLINEEXACT_HPP) | |
| #define GEOGRAPHICLIB_GEODESICLINEEXACT_HPP 1 | | #define GEOGRAPHICLIB_GEODESICLINEEXACT_HPP 1 | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/GeodesicExact.hpp> | | #include <GeographicLib/GeodesicExact.hpp> | |
| #include <GeographicLib/EllipticFunction.hpp> | | #include <GeographicLib/EllipticFunction.hpp> | |
| | | | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| EllipticFunction _E; | | EllipticFunction _E; | |
| unsigned _caps; | | unsigned _caps; | |
| | | | |
| enum captype { | | enum captype { | |
| CAP_NONE = GeodesicExact::CAP_NONE, | | CAP_NONE = GeodesicExact::CAP_NONE, | |
| CAP_E = GeodesicExact::CAP_E, | | CAP_E = GeodesicExact::CAP_E, | |
| CAP_D = GeodesicExact::CAP_D, | | CAP_D = GeodesicExact::CAP_D, | |
| CAP_H = GeodesicExact::CAP_H, | | CAP_H = GeodesicExact::CAP_H, | |
| CAP_C4 = GeodesicExact::CAP_C4, | | CAP_C4 = GeodesicExact::CAP_C4, | |
| CAP_ALL = GeodesicExact::CAP_ALL, | | CAP_ALL = GeodesicExact::CAP_ALL, | |
|
| | | CAP_MASK = GeodesicExact::CAP_MASK, | |
| OUT_ALL = GeodesicExact::OUT_ALL, | | OUT_ALL = GeodesicExact::OUT_ALL, | |
|
| | | OUT_MASK = GeodesicExact::OUT_MASK, | |
| }; | | }; | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Bit masks for what calculations to do. They signify to the | | * Bit masks for what calculations to do. They signify to the | |
| * GeodesicLineExact::GeodesicLineExact constructor and to | | * GeodesicLineExact::GeodesicLineExact constructor and to | |
| * GeodesicExact::Line what capabilities should be included in the | | * GeodesicExact::Line what capabilities should be included in the | |
| * GeodesicLineExact object. This is merely a duplication of | | * GeodesicLineExact object. This is merely a duplication of | |
| * GeodesicExact::mask. | | * GeodesicExact::mask. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| | | | |
| skipping to change at line 120 | | skipping to change at line 122 | |
| * Calculate geodesic scales \e M12 and \e M21. | | * Calculate geodesic scales \e M12 and \e M21. | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| GEODESICSCALE = GeodesicExact::GEODESICSCALE, | | GEODESICSCALE = GeodesicExact::GEODESICSCALE, | |
| /** | | /** | |
| * Calculate area \e S12. | | * Calculate area \e S12. | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| AREA = GeodesicExact::AREA, | | AREA = GeodesicExact::AREA, | |
| /** | | /** | |
|
| * All capabilities, calculate everything. | | * Do not wrap \e lon2 in the direct calculation. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LONG_NOWRAP = GeodesicExact::LONG_NOWRAP, | |
| | | /** | |
| | | * All capabilities, calculate everything. (LONG_NOWRAP is not | |
| | | * included in this mask.) | |
| * @hideinitializer | | * @hideinitializer | |
| ********************************************************************
**/ | | ********************************************************************
**/ | |
| ALL = GeodesicExact::ALL, | | ALL = GeodesicExact::ALL, | |
| }; | | }; | |
| | | | |
| /** \name Constructors | | /** \name Constructors | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| ///@{ | | ///@{ | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 470 | | skipping to change at line 478 | |
| * The GeodesicLineExact::mask values possible for \e outmask are | | * The GeodesicLineExact::mask values possible for \e outmask are | |
| * - \e outmask |= GeodesicLineExact::LATITUDE for the latitude \e lat2
; | | * - \e outmask |= GeodesicLineExact::LATITUDE for the latitude \e lat2
; | |
| * - \e outmask |= GeodesicLineExact::LONGITUDE for the latitude \e lon
2; | | * - \e outmask |= GeodesicLineExact::LONGITUDE for the latitude \e lon
2; | |
| * - \e outmask |= GeodesicLineExact::AZIMUTH for the latitude \e azi2; | | * - \e outmask |= GeodesicLineExact::AZIMUTH for the latitude \e azi2; | |
| * - \e outmask |= GeodesicLineExact::DISTANCE for the distance \e s12; | | * - \e outmask |= GeodesicLineExact::DISTANCE for the distance \e s12; | |
| * - \e outmask |= GeodesicLineExact::REDUCEDLENGTH for the reduced len
gth | | * - \e outmask |= GeodesicLineExact::REDUCEDLENGTH for the reduced len
gth | |
| * \e m12; | | * \e m12; | |
| * - \e outmask |= GeodesicLineExact::GEODESICSCALE for the geodesic sc
ales | | * - \e outmask |= GeodesicLineExact::GEODESICSCALE for the geodesic sc
ales | |
| * \e M12 and \e M21; | | * \e M12 and \e M21; | |
| * - \e outmask |= GeodesicLineExact::AREA for the area \e S12; | | * - \e outmask |= GeodesicLineExact::AREA for the area \e S12; | |
|
| * - \e outmask |= GeodesicLine::ALL for all of the above. | | * - \e outmask |= GeodesicLineExact::ALL for all of the above; | |
| | | * - \e outmask |= GeodesicLineExact::LONG_NOWRAP stops the returned va | |
| | | lue | |
| | | * of \e lon2 being wrapped into the range [−180°, 180° | |
| | | ). | |
| * . | | * . | |
| * Requesting a value which the GeodesicLineExact object is not capable
of | | * Requesting a value which the GeodesicLineExact object is not capable
of | |
| * computing is not an error; the corresponding argument will not be | | * computing is not an error; the corresponding argument will not be | |
| * altered. Note, however, that the arc length is always computed and | | * altered. Note, however, that the arc length is always computed and | |
| * returned as the function value. | | * returned as the function value. | |
|
| | | * | |
| | | * With the LONG_NOWRAP bit set, the quantity \e lon2 − \e lon1 | |
| | | * indicates how many times the geodesic wrapped around the ellipsoid. | |
| | | * Because \e lon2 might be outside the normal allowed range for | |
| | | * longitudes, [−540°, 540°), be sure to normalize it wit | |
| | | h | |
| | | * Math::AngNormalize2 before using it in other GeographicLib calls. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, | | Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, | |
| real& lat2, real& lon2, real& azi2, | | real& lat2, real& lon2, real& azi2, | |
| real& s12, real& m12, real& M12, real& M21, | | real& s12, real& m12, real& M12, real& M21, | |
| real& S12) const; | | real& S12) const; | |
| | | | |
| ///@} | | ///@} | |
| | | | |
| /** \name Inspector functions | | /** \name Inspector functions | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 25 lines changed or added | |
|
| PolygonArea.hpp | | PolygonArea.hpp | |
| /** | | /** | |
| * \file PolygonArea.hpp | | * \file PolygonArea.hpp | |
|
| * \brief Header for GeographicLib::PolygonArea class | | * \brief Header for GeographicLib::PolygonAreaT class | |
| * | | * | |
| * Copyright (c) Charles Karney (2010-2014) <charles@karney.com> and licens
ed | | * Copyright (c) Charles Karney (2010-2014) <charles@karney.com> and licens
ed | |
| * under the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP) | | #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP) | |
| #define GEOGRAPHICLIB_POLYGONAREA_HPP 1 | | #define GEOGRAPHICLIB_POLYGONAREA_HPP 1 | |
| | | | |
| #include <GeographicLib/Geodesic.hpp> | | #include <GeographicLib/Geodesic.hpp> | |
| #include <GeographicLib/GeodesicExact.hpp> | | #include <GeographicLib/GeodesicExact.hpp> | |
|
| | | #include <GeographicLib/Rhumb.hpp> | |
| #include <GeographicLib/Accumulator.hpp> | | #include <GeographicLib/Accumulator.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Polygon areas | | * \brief Polygon areas | |
| * | | * | |
| * This computes the area of a polygon whose edges are geodesics using th
e | | * This computes the area of a polygon whose edges are geodesics using th
e | |
| * method given in Section 6 of | | * method given in Section 6 of | |
| * - C. F. F. Karney, | | * - C. F. F. Karney, | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 43 | |
| * | | * | |
| * This class lets you add vertices and edges one at a time to the polygo
n. | | * This class lets you add vertices and edges one at a time to the polygo
n. | |
| * The sequence must start with a vertex and thereafter vertices and edge
s | | * The sequence must start with a vertex and thereafter vertices and edge
s | |
| * can be added in any order. Any vertex after the first creates a new e
dge | | * can be added in any order. Any vertex after the first creates a new e
dge | |
| * which is the ''shortest'' geodesic from the previous vertex. In some | | * which is the ''shortest'' geodesic from the previous vertex. In some | |
| * cases there may be two or many such shortest geodesics and the area is | | * cases there may be two or many such shortest geodesics and the area is | |
| * then not uniquely defined. In this case, either add an intermediate | | * then not uniquely defined. In this case, either add an intermediate | |
| * vertex or add the edge ''as'' an edge (by defining its direction and | | * vertex or add the edge ''as'' an edge (by defining its direction and | |
| * length). | | * length). | |
| * | | * | |
|
| * The area and perimeter are accumulated in two times the standard float
ing | | * The area and perimeter are accumulated at two times the standard float
ing | |
| * point precision to guard against the loss of accuracy with many-sided | | * point precision to guard against the loss of accuracy with many-sided | |
| * polygons. At any point you can ask for the perimeter and area so far. | | * polygons. At any point you can ask for the perimeter and area so far. | |
| * There's an option to treat the points as defining a polyline instead o
f a | | * There's an option to treat the points as defining a polyline instead o
f a | |
| * polygon; in that case, only the perimeter is computed. | | * polygon; in that case, only the perimeter is computed. | |
| * | | * | |
|
| * This is a templated class to allow it to be used with either Geodesic | | * This is a templated class to allow it to be used with Geodesic, | |
| and | | * GeodesicExact, and Rhumb. GeographicLib::PolygonArea, | |
| * GeodesicExact. GeographicLib::PolygonArea and | | * GeographicLib::PolygonAreaExact, and GeographicLib::PolygonAreaRhumb a | |
| * GeographicLib::PolygonAreaExact are typedefs for these two cases. | | re | |
| | | * typedefs for these cases. | |
| * | | * | |
| * @tparam GeodType the geodesic class to use. | | * @tparam GeodType the geodesic class to use. | |
| * | | * | |
| * Example of use: | | * Example of use: | |
| * \include example-PolygonArea.cpp | | * \include example-PolygonArea.cpp | |
| * | | * | |
| * <a href="Planimeter.1.html">Planimeter</a> is a command-line utility | | * <a href="Planimeter.1.html">Planimeter</a> is a command-line utility | |
|
| * providing access to the functionality of PolygonArea. | | * providing access to the functionality of PolygonAreaT. | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| template <class GeodType = Geodesic> | | template <class GeodType = Geodesic> | |
| class PolygonAreaT { | | class PolygonAreaT { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| GeodType _earth; | | GeodType _earth; | |
| real _area0; // Full ellipsoid area | | real _area0; // Full ellipsoid area | |
| bool _polyline; // Assume polyline (don't close and skip ar
ea) | | bool _polyline; // Assume polyline (don't close and skip ar
ea) | |
| unsigned _mask; | | unsigned _mask; | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 87 | |
| // Otherwise return zero. | | // Otherwise return zero. | |
| // Compute lon12 the same way as Geodesic::Inverse. | | // Compute lon12 the same way as Geodesic::Inverse. | |
| lon1 = Math::AngNormalize(lon1); | | lon1 = Math::AngNormalize(lon1); | |
| lon2 = Math::AngNormalize(lon2); | | lon2 = Math::AngNormalize(lon2); | |
| real lon12 = Math::AngDiff(lon1, lon2); | | real lon12 = Math::AngDiff(lon1, lon2); | |
| int cross = | | int cross = | |
| lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 : | | lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 : | |
| (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0); | | (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0); | |
| return cross; | | return cross; | |
| } | | } | |
|
| | | // an alternate version of transit to deal with longitudes in the direc | |
| | | t | |
| | | // problem. | |
| | | static inline int transitdirect(real lon1, real lon2) { | |
| | | using std::fmod; | |
| | | // We want to compute exactly | |
| | | // int(floor(lon2 / 360)) - int(floor(lon1 / 360)) | |
| | | // Since we only need the parity of the result we can use std::remquo | |
| | | but | |
| | | // this is buggy with g++ 4.8.3 and requires C++11. So instead we do | |
| | | lon1 = fmod(lon1, real(720)); lon2 = fmod(lon2, real(720)); | |
| | | return ( ((lon2 >= 0 && lon2 < 360) || lon2 < -360 ? 0 : 1) - | |
| | | ((lon1 >= 0 && lon1 < 360) || lon1 < -360 ? 0 : 1) ); | |
| | | } | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Constructor for PolygonAreaT. | | * Constructor for PolygonAreaT. | |
| * | | * | |
| * @param[in] earth the Geodesic object to use for geodesic calculation
s. | | * @param[in] earth the Geodesic object to use for geodesic calculation
s. | |
| * @param[in] polyline if true that treat the points as defining a poly
line | | * @param[in] polyline if true that treat the points as defining a poly
line | |
| * instead of a polygon (default = false). | | * instead of a polygon (default = false). | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| PolygonAreaT(const GeodType& earth, bool polyline = false) | | PolygonAreaT(const GeodType& earth, bool polyline = false) | |
| : _earth(earth) | | : _earth(earth) | |
| , _area0(_earth.EllipsoidArea()) | | , _area0(_earth.EllipsoidArea()) | |
| , _polyline(polyline) | | , _polyline(polyline) | |
| , _mask(GeodType::LATITUDE | GeodType::LONGITUDE | GeodType::DISTANCE
| | | , _mask(GeodType::LATITUDE | GeodType::LONGITUDE | GeodType::DISTANCE
| | |
|
| (_polyline ? GeodType::NONE : GeodType::AREA)) | | (_polyline ? GeodType::NONE : | |
| | | GeodType::AREA | GeodType::LONG_NOWRAP)) | |
| { Clear(); } | | { Clear(); } | |
| | | | |
| /** | | /** | |
| * Clear PolygonAreaT, allowing a new polygon to be started. | | * Clear PolygonAreaT, allowing a new polygon to be started. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Clear() { | | void Clear() { | |
| _num = 0; | | _num = 0; | |
| _crossings = 0; | | _crossings = 0; | |
| _areasum = 0; | | _areasum = 0; | |
| _perimetersum = 0; | | _perimetersum = 0; | |
| | | | |
| skipping to change at line 268 | | skipping to change at line 283 | |
| | | | |
| /** | | /** | |
| * @relates PolygonAreaT | | * @relates PolygonAreaT | |
| * | | * | |
| * Polygon areas using GeodesicExact. (But note that the implementation
of | | * Polygon areas using GeodesicExact. (But note that the implementation
of | |
| * areas in GeodesicExact uses a high order series and this is only accur
ate | | * areas in GeodesicExact uses a high order series and this is only accur
ate | |
| * for modest flattenings.) | | * for modest flattenings.) | |
| **********************************************************************/ | | **********************************************************************/ | |
| typedef PolygonAreaT<GeodesicExact> PolygonAreaExact; | | typedef PolygonAreaT<GeodesicExact> PolygonAreaExact; | |
| | | | |
|
| | | /** | |
| | | * @relates PolygonAreaT | |
| | | * | |
| | | * Polygon areas using Rhumb. | |
| | | **********************************************************************/ | |
| | | typedef PolygonAreaT<Rhumb> PolygonAreaRhumb; | |
| | | | |
| } // namespace GeographicLib | | } // namespace GeographicLib | |
| | | | |
| #endif // GEOGRAPHICLIB_POLYGONAREA_HPP | | #endif // GEOGRAPHICLIB_POLYGONAREA_HPP | |
| | | | |
End of changes. 8 change blocks. |
| 8 lines changed or deleted | | 32 lines changed or added | |
|
| Rhumb.hpp | | Rhumb.hpp | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_RHUMB_HPP) | | #if !defined(GEOGRAPHICLIB_RHUMB_HPP) | |
| #define GEOGRAPHICLIB_RHUMB_HPP 1 | | #define GEOGRAPHICLIB_RHUMB_HPP 1 | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/Ellipsoid.hpp> | | #include <GeographicLib/Ellipsoid.hpp> | |
| | | | |
|
| | | #if !defined(GEOGRAPHICLIB_RHUMBAREA_ORDER) | |
| | | /** | |
| | | * The order of the series approximation used in rhumb area calculations. | |
| | | * GEOGRAPHICLIB_RHUMBAREA_ORDER can be set to any integer in [4, 8]. | |
| | | **********************************************************************/ | |
| | | # define GEOGRAPHICLIB_RHUMBAREA_ORDER \ | |
| | | (GEOGRAPHICLIB_PRECISION == 2 ? 6 : \ | |
| | | (GEOGRAPHICLIB_PRECISION == 1 ? 4 : 8)) | |
| | | #endif | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| class RhumbLine; | | class RhumbLine; | |
|
| | | template <class T> class PolygonAreaT; | |
| | | | |
| /** | | /** | |
| * \brief Solve of the direct and inverse rhumb problems. | | * \brief Solve of the direct and inverse rhumb problems. | |
| * | | * | |
| * The path of constant azimuth between two points on a ellipsoid at (\e | | * The path of constant azimuth between two points on a ellipsoid at (\e | |
| * lat1, \e lon1) and (\e lat2, \e lon2) is called the rhumb line (also | | * lat1, \e lon1) and (\e lat2, \e lon2) is called the rhumb line (also | |
|
| * called the loxodrome). Its length is \e s12 and its azimuth is \e azi | | * called the loxodrome). Its length is \e s12 and its azimuth is \e azi | |
| 12 | | 12. | |
| * and \e azi2. (The azimuth is the heading measured clockwise from nort | | * (The azimuth is the heading measured clockwise from north.) | |
| h.) | | | |
| * | | * | |
| * Given \e lat1, \e lon1, \e azi12, and \e s12, we can determine \e lat2
, | | * Given \e lat1, \e lon1, \e azi12, and \e s12, we can determine \e lat2
, | |
| * and \e lon2. This is the \e direct rhumb problem and its solution is | | * and \e lon2. This is the \e direct rhumb problem and its solution is | |
| * given by the function Rhumb::Direct. | | * given by the function Rhumb::Direct. | |
| * | | * | |
| * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi1
2 | | * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi1
2 | |
|
| * and \e s12. This is the \e inverse rhumb problem, whose solution is | | * and \e s12. This is the \e inverse rhumb problem, whose solution is g | |
| * given by Rhumb::Inverse. This finds the shortest such rhumb line, i.e | | iven | |
| ., | | * by Rhumb::Inverse. This finds the shortest such rhumb line, i.e., the | |
| * the one that wraps no more than half way around the earth . | | one | |
| | | * that wraps no more than half way around the earth. If the end points | |
| | | are | |
| | | * on opposite meridians, there are two shortest rhumb lines and the | |
| | | * east-going one is chosen. | |
| | | * | |
| | | * These routines also optionally calculate the area under the rhumb line | |
| | | , \e | |
| | | * S12. This is the area, measured counter-clockwise, of the rhumb line | |
| | | * quadrilateral with corners (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), | |
| | | * (0,<i>lon2</i>), and (<i>lat2</i>,<i>lon2</i>). | |
| * | | * | |
| * Note that rhumb lines may be appreciably longer (up to 50%) than the | | * Note that rhumb lines may be appreciably longer (up to 50%) than the | |
| * corresponding Geodesic. For example the distance between London Heath
row | | * corresponding Geodesic. For example the distance between London Heath
row | |
| * and Tokyo Narita via the rhumb line is 11400 km which is 18% longer th
an | | * and Tokyo Narita via the rhumb line is 11400 km which is 18% longer th
an | |
| * the geodesic distance 9600 km. | | * the geodesic distance 9600 km. | |
| * | | * | |
| * For more information on rhumb lines see \ref rhumb. | | * For more information on rhumb lines see \ref rhumb. | |
| * | | * | |
| * Example of use: | | * Example of use: | |
| * \include example-Rhumb.cpp | | * \include example-Rhumb.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHICLIB_EXPORT Rhumb { | | class GEOGRAPHICLIB_EXPORT Rhumb { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| friend class RhumbLine; | | friend class RhumbLine; | |
|
| | | template <class T> friend class PolygonAreaT; | |
| Ellipsoid _ell; | | Ellipsoid _ell; | |
| bool _exact; | | bool _exact; | |
|
| | | real _c2; | |
| static const int tm_maxord = GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER; | | static const int tm_maxord = GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER; | |
|
| | | static const int maxpow_ = GEOGRAPHICLIB_RHUMBAREA_ORDER; | |
| | | // _R[0] unused | |
| | | real _R[maxpow_ + 1]; | |
| static inline real overflow() { | | static inline real overflow() { | |
| // Overflow value s.t. atan(overflow_) = pi/2 | | // Overflow value s.t. atan(overflow_) = pi/2 | |
| static const real | | static const real | |
| overflow = 1 / Math::sq(std::numeric_limits<real>::epsilon()); | | overflow = 1 / Math::sq(std::numeric_limits<real>::epsilon()); | |
| return overflow; | | return overflow; | |
| } | | } | |
| static inline real tano(real x) { | | static inline real tano(real x) { | |
| using std::abs; using std::tan; | | using std::abs; using std::tan; | |
| return | | return | |
| 2 * abs(x) == Math::pi() ? (x < 0 ? - overflow() : overflow()) : | | 2 * abs(x) == Math::pi() ? (x < 0 ? - overflow() : overflow()) : | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 104 | |
| // accurately | | // accurately | |
| // | | // | |
| // Definition: Df(x,y,d) = (f(x) - f(y)) / (x - y) | | // Definition: Df(x,y,d) = (f(x) - f(y)) / (x - y) | |
| // See: | | // See: | |
| // W. M. Kahan and R. J. Fateman, | | // W. M. Kahan and R. J. Fateman, | |
| // Symbolic computation of divided differences, | | // Symbolic computation of divided differences, | |
| // SIGSAM Bull. 33(3), 7-28 (1999) | | // SIGSAM Bull. 33(3), 7-28 (1999) | |
| // http://dx.doi.org/10.1145/334714.334716 | | // http://dx.doi.org/10.1145/334714.334716 | |
| // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf | | // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf | |
| | | | |
|
| | | static inline real Dlog(real x, real y) { | |
| | | real t = x - y; | |
| | | return t ? 2 * Math::atanh(t / (x + y)) / t : 1 / x; | |
| | | } | |
| static inline real Dtan(real x, real y) { | | static inline real Dtan(real x, real y) { | |
| real d = x - y, tx = tano(x), ty = tano(y), txy = tx * ty; | | real d = x - y, tx = tano(x), ty = tano(y), txy = tx * ty; | |
| return d ? (2 * txy > -1 ? (1 + txy) * tano(d) : tx - ty) / d : | | return d ? (2 * txy > -1 ? (1 + txy) * tano(d) : tx - ty) / d : | |
| 1 + txy; | | 1 + txy; | |
| } | | } | |
| static inline real Datan(real x, real y) { | | static inline real Datan(real x, real y) { | |
| using std::atan; | | using std::atan; | |
| real d = x - y, xy = x * y; | | real d = x - y, xy = x * y; | |
| return d ? (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) /
d : | | return d ? (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) /
d : | |
| 1 / (1 + xy); | | 1 / (1 + xy); | |
| } | | } | |
| static inline real Dsin(real x, real y) { | | static inline real Dsin(real x, real y) { | |
| using std::sin; using std::cos; | | using std::sin; using std::cos; | |
|
| real d = (x - y)/2; | | real d = (x - y) / 2; | |
| return cos((x + y)/2) * (d ? sin(d) / d : 1); | | return cos((x + y)/2) * (d ? sin(d) / d : 1); | |
| } | | } | |
| static inline real Dsinh(real x, real y) { | | static inline real Dsinh(real x, real y) { | |
| using std::sinh; using std::cosh; | | using std::sinh; using std::cosh; | |
|
| real d = (x - y)/2; | | real d = (x - y) / 2; | |
| return cosh((x + y)/2) * (d ? sinh(d) / d : 1); | | return cosh((x + y) / 2) * (d ? sinh(d) / d : 1); | |
| | | } | |
| | | static inline real Dcosh(real x, real y) { | |
| | | using std::sinh; | |
| | | real d = (x - y) / 2; | |
| | | return sinh((x + y) / 2) * (d ? sinh(d) / d : 1); | |
| } | | } | |
| static inline real Dasinh(real x, real y) { | | static inline real Dasinh(real x, real y) { | |
| real d = x - y, | | real d = x - y, | |
| hx = Math::hypot(real(1), x), hy = Math::hypot(real(1), y); | | hx = Math::hypot(real(1), x), hy = Math::hypot(real(1), y); | |
| return d ? Math::asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) : | | return d ? Math::asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) : | |
| x*hy - y*hx) / d : | | x*hy - y*hx) / d : | |
| 1 / hx; | | 1 / hx; | |
| } | | } | |
| static inline real Dgd(real x, real y) { | | static inline real Dgd(real x, real y) { | |
| using std::sinh; | | using std::sinh; | |
| | | | |
| skipping to change at line 138 | | skipping to change at line 170 | |
| return t ? eatanhe(t / d) / t : _ell._e2 / d; | | return t ? eatanhe(t / d) / t : _ell._e2 / d; | |
| } | | } | |
| // (E(x) - E(y)) / (x - y) -- E = incomplete elliptic integral of 2nd k
ind | | // (E(x) - E(y)) / (x - y) -- E = incomplete elliptic integral of 2nd k
ind | |
| real DE(real x, real y) const; | | real DE(real x, real y) const; | |
| // (mux - muy) / (phix - phiy) using elliptic integrals | | // (mux - muy) / (phix - phiy) using elliptic integrals | |
| real DRectifying(real latx, real laty) const; | | real DRectifying(real latx, real laty) const; | |
| // (psix - psiy) / (phix - phiy) | | // (psix - psiy) / (phix - phiy) | |
| real DIsometric(real latx, real laty) const; | | real DIsometric(real latx, real laty) const; | |
| | | | |
| // (sum(c[j]*sin(2*j*x),j=1..n) - sum(c[j]*sin(2*j*x),j=1..n)) / (x - y
) | | // (sum(c[j]*sin(2*j*x),j=1..n) - sum(c[j]*sin(2*j*x),j=1..n)) / (x - y
) | |
|
| static real SinSeries(real x, real y, const real c[], int n); | | static real SinCosSeries(bool sinp, | |
| | | real x, real y, const real c[], int n); | |
| // (mux - muy) / (chix - chiy) using Krueger's series | | // (mux - muy) / (chix - chiy) using Krueger's series | |
| real DConformalToRectifying(real chix, real chiy) const; | | real DConformalToRectifying(real chix, real chiy) const; | |
| // (chix - chiy) / (mux - muy) using Krueger's series | | // (chix - chiy) / (mux - muy) using Krueger's series | |
| real DRectifyingToConformal(real mux, real muy) const; | | real DRectifyingToConformal(real mux, real muy) const; | |
| | | | |
| // (mux - muy) / (psix - psiy) | | // (mux - muy) / (psix - psiy) | |
| real DIsometricToRectifying(real psix, real psiy) const; | | real DIsometricToRectifying(real psix, real psiy) const; | |
| // (psix - psiy) / (mux - muy) | | // (psix - psiy) / (mux - muy) | |
| real DRectifyingToIsometric(real mux, real muy) const; | | real DRectifyingToIsometric(real mux, real muy) const; | |
| | | | |
|
| | | real MeanSinXi(real psi1, real psi2) const; | |
| | | | |
| | | // The following two functions (with lots of ignored arguments) mimic t | |
| | | he | |
| | | // interface to the corresponding Geodesic function. These are needed | |
| | | by | |
| | | // PolygonAreaT. | |
| | | void GenDirect(real lat1, real lon1, real azi12, | |
| | | bool, real s12, unsigned outmask, | |
| | | real& lat2, real& lon2, real&, real&, real&, real&, real | |
| | | &, | |
| | | real& S12) const { | |
| | | GenDirect(lat1, lon1, azi12, s12, outmask, lat2, lon2, S12); | |
| | | } | |
| | | void GenInverse(real lat1, real lon1, real lat2, real lon2, | |
| | | unsigned outmask, real& s12, real& azi12, | |
| | | real&, real& , real& , real& , real& S12) const { | |
| | | GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi12, S12); | |
| | | } | |
| public: | | public: | |
| | | | |
| /** | | /** | |
|
| | | * Bit masks for what calculations to do. They specify which results t | |
| | | o | |
| | | * return in the general routines Rhumb::GenDirect and Rhumb::GenInvers | |
| | | e | |
| | | * routines. RhumbLine::mask is a duplication of this enum. | |
| | | ********************************************************************** | |
| | | / | |
| | | enum mask { | |
| | | /** | |
| | | * No output. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | NONE = 0U, | |
| | | /** | |
| | | * Calculate latitude \e lat2. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LATITUDE = 1U<<7, | |
| | | /** | |
| | | * Calculate longitude \e lon2. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LONGITUDE = 1U<<8, | |
| | | /** | |
| | | * Calculate azimuth \e azi12. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | AZIMUTH = 1U<<9, | |
| | | /** | |
| | | * Calculate distance \e s12. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | DISTANCE = 1U<<10, | |
| | | /** | |
| | | * Calculate area \e S12. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | AREA = 1U<<14, | |
| | | /** | |
| | | * Do not wrap the \e lon2 in the direct calculation. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LONG_NOWRAP = 1U<<15, | |
| | | /** | |
| | | * Calculate everything. (LONG_NOWRAP is not included in this mask.) | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | ALL = 0x7F80U, | |
| | | }; | |
| | | | |
| | | /** | |
| * Constructor for a ellipsoid with | | * Constructor for a ellipsoid with | |
| * | | * | |
| * @param[in] a equatorial radius (meters). | | * @param[in] a equatorial radius (meters). | |
| * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
re. | | * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
re. | |
| * Negative \e f gives a prolate ellipsoid. If \e f > 1, set | | * Negative \e f gives a prolate ellipsoid. If \e f > 1, set | |
| * flattening to 1/\e f. | | * flattening to 1/\e f. | |
| * @param[in] exact if true (the default) use an addition theorem for | | * @param[in] exact if true (the default) use an addition theorem for | |
| * elliptic integrals to compute divided differences; otherwise use | | * elliptic integrals to compute divided differences; otherwise use | |
| * series expansion (accurate for |<i>f</i>| < 0.01). | | * series expansion (accurate for |<i>f</i>| < 0.01). | |
| * @exception GeographicErr if \e a or (1 − \e f) \e a is not | | * @exception GeographicErr if \e a or (1 − \e f) \e a is not | |
| * positive. | | * positive. | |
| * | | * | |
| * See \ref rhumb, for a detailed description of the \e exact parameter
. | | * See \ref rhumb, for a detailed description of the \e exact parameter
. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
|
| Rhumb(real a, real f, bool exact = true) : _ell(a, f), _exact(exact) {} | | Rhumb(real a, real f, bool exact = true); | |
| | | | |
| /** | | /** | |
|
| * Solve the direct rhumb problem. | | * Solve the direct rhumb problem returning also the area. | |
| * | | * | |
| * @param[in] lat1 latitude of point 1 (degrees). | | * @param[in] lat1 latitude of point 1 (degrees). | |
| * @param[in] lon1 longitude of point 1 (degrees). | | * @param[in] lon1 longitude of point 1 (degrees). | |
| * @param[in] azi12 azimuth of the rhumb line (degrees). | | * @param[in] azi12 azimuth of the rhumb line (degrees). | |
| * @param[in] s12 distance between point 1 and point 2 (meters); it can
be | | * @param[in] s12 distance between point 1 and point 2 (meters); it can
be | |
| * negative. | | * negative. | |
| * @param[out] lat2 latitude of point 2 (degrees). | | * @param[out] lat2 latitude of point 2 (degrees). | |
| * @param[out] lon2 longitude of point 2 (degrees). | | * @param[out] lon2 longitude of point 2 (degrees). | |
|
| | | * @param[out] S12 area under the rhumb line (meters<sup>2</sup>). | |
| * | | * | |
| * \e lat1 should be in the range [−90°, 90°]; \e lon1 an
d \e | | * \e lat1 should be in the range [−90°, 90°]; \e lon1 an
d \e | |
|
| * azi1 should be in the range [−540°, 540°). The values | | * azi12 should be in the range [−540°, 540°). The value | |
| of | | of | |
| * \e lon2 and \e azi2 returned are in the range [−180°, | | * \e lon2 returned is in the range [−180°, 180°). | |
| * 180°). | | | |
| * | | * | |
| * If point 1 is a pole, the cosine of its latitude is taken to be | | * If point 1 is a pole, the cosine of its latitude is taken to be | |
| * 1/ε<sup>2</sup> (where ε is 2<sup>-52</sup>). This | | * 1/ε<sup>2</sup> (where ε is 2<sup>-52</sup>). This | |
| * position, which is extremely close to the actual pole, allows the | | * position, which is extremely close to the actual pole, allows the | |
| * calculation to be carried out in finite terms. If \e s12 is large | | * calculation to be carried out in finite terms. If \e s12 is large | |
| * enough that the rhumb line crosses a pole, the longitude of point 2 | | * enough that the rhumb line crosses a pole, the longitude of point 2 | |
|
| * is indeterminate (a NaN is returned for \e lon2). | | * is indeterminate (a NaN is returned for \e lon2 and \e S12). | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Direct(real lat1, real lon1, real azi12, real s12, | | void Direct(real lat1, real lon1, real azi12, real s12, | |
|
| real& lat2, real& lon2) const; | | real& lat2, real& lon2, real& S12) const { | |
| | | GenDirect(lat1, lon1, azi12, s12, | |
| | | LATITUDE | LONGITUDE | AREA, lat2, lon2, S12); | |
| | | } | |
| | | | |
| /** | | /** | |
|
| * Solve the inverse rhumb problem. | | * Solve the direct rhumb problem without the area. | |
| | | ********************************************************************** | |
| | | / | |
| | | void Direct(real lat1, real lon1, real azi12, real s12, | |
| | | real& lat2, real& lon2) const { | |
| | | real t; | |
| | | GenDirect(lat1, lon1, azi12, s12, LATITUDE | LONGITUDE, lat2, lon2, t | |
| | | ); | |
| | | } | |
| | | | |
| | | /** | |
| | | * The general direct rhumb problem. Rhumb::Direct is defined in terms | |
| | | * of this function. | |
| | | * | |
| | | * @param[in] lat1 latitude of point 1 (degrees). | |
| | | * @param[in] lon1 longitude of point 1 (degrees). | |
| | | * @param[in] azi12 azimuth of the rhumb line (degrees). | |
| | | * @param[in] s12 distance between point 1 and point 2 (meters); it can | |
| | | be | |
| | | * negative. | |
| | | * @param[in] outmask a bitor'ed combination of Rhumb::mask values | |
| | | * specifying which of the following parameters should be set. | |
| | | * @param[out] lat2 latitude of point 2 (degrees). | |
| | | * @param[out] lon2 longitude of point 2 (degrees). | |
| | | * @param[out] S12 area under the rhumb line (meters<sup>2</sup>). | |
| | | * | |
| | | * The Rhumb::mask values possible for \e outmask are | |
| | | * - \e outmask |= Rhumb::LATITUDE for the latitude \e lat2; | |
| | | * - \e outmask |= Rhumb::LONGITUDE for the latitude \e lon2; | |
| | | * - \e outmask |= Rhumb::AREA for the area \e S12; | |
| | | * - \e outmask |= Rhumb::ALL for all of the above; | |
| | | * - \e outmask |= Rhumb::LONG_NOWRAP stops the returned value of \e | |
| | | * lon2 being wrapped into the range [−180°, 180°). | |
| | | * . | |
| | | * With the LONG_NOWRAP bit set, the quantity \e lon2 − \e lon1 | |
| | | * indicates how many times the rhumb line wrapped around the ellipsoid | |
| | | . | |
| | | * Because \e lon2 might be outside the normal allowed range for | |
| | | * longitudes, [−540°, 540°), be sure to normalize it wit | |
| | | h | |
| | | * Math::AngNormalize2 before using it in other GeographicLib calls. | |
| | | ********************************************************************** | |
| | | / | |
| | | void GenDirect(real lat1, real lon1, real azi12, real s12, unsigned out | |
| | | mask, | |
| | | real& lat2, real& lon2, real& S12) const; | |
| | | | |
| | | /** | |
| | | * Solve the inverse rhumb problem returning also the area. | |
| * | | * | |
| * @param[in] lat1 latitude of point 1 (degrees). | | * @param[in] lat1 latitude of point 1 (degrees). | |
| * @param[in] lon1 longitude of point 1 (degrees). | | * @param[in] lon1 longitude of point 1 (degrees). | |
| * @param[in] lat2 latitude of point 2 (degrees). | | * @param[in] lat2 latitude of point 2 (degrees). | |
| * @param[in] lon2 longitude of point 2 (degrees). | | * @param[in] lon2 longitude of point 2 (degrees). | |
| * @param[out] s12 rhumb distance between point 1 and point 2 (meters). | | * @param[out] s12 rhumb distance between point 1 and point 2 (meters). | |
| * @param[out] azi12 azimuth of the rhumb line (degrees). | | * @param[out] azi12 azimuth of the rhumb line (degrees). | |
|
| | | * @param[out] S12 area under the rhumb line (meters<sup>2</sup>). | |
| * | | * | |
|
| * The shortest rhumb line is found. \e lat1 and \e lat2 should be in | | * The shortest rhumb line is found. If the end points are on opposite | |
| the | | * meridians, there are two shortest rhumb lines and the east-going one | |
| * range [−90°, 90°]; \e lon1 and \e lon2 should be in th | | is | |
| e | | * chosen. \e lat1 and \e lat2 should be in the range [−90°, | |
| * range [−540°, 540°). The value of \e azi12 returned i | | * 90°]; \e lon1 and \e lon2 should be in the range [−540° | |
| s in | | ;, | |
| * the range [−180°, 180°). | | * 540°). The value of \e azi12 returned is in the range | |
| | | * [−180°, 180°). | |
| * | | * | |
| * If either point is a pole, the cosine of its latitude is taken to be | | * If either point is a pole, the cosine of its latitude is taken to be | |
| * 1/ε<sup>2</sup> (where ε is 2<sup>-52</sup>). This | | * 1/ε<sup>2</sup> (where ε is 2<sup>-52</sup>). This | |
| * position, which is extremely close to the actual pole, allows the | | * position, which is extremely close to the actual pole, allows the | |
| * calculation to be carried out in finite terms. | | * calculation to be carried out in finite terms. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Inverse(real lat1, real lon1, real lat2, real lon2, | | void Inverse(real lat1, real lon1, real lat2, real lon2, | |
|
| real& s12, real& azi12) const; | | real& s12, real& azi12, real& S12) const { | |
| | | GenInverse(lat1, lon1, lat2, lon2, | |
| | | DISTANCE | AZIMUTH | AREA, s12, azi12, S12); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Solve the inverse rhumb problem without the area. | |
| | | ********************************************************************** | |
| | | / | |
| | | void Inverse(real lat1, real lon1, real lat2, real lon2, | |
| | | real& s12, real& azi12) const { | |
| | | real t; | |
| | | GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi12, t) | |
| | | ; | |
| | | } | |
| | | | |
| | | /** | |
| | | * The general inverse rhumb problem. Rhumb::Inverse is defined in ter | |
| | | ms | |
| | | * of this function. | |
| | | * | |
| | | * @param[in] lat1 latitude of point 1 (degrees). | |
| | | * @param[in] lon1 longitude of point 1 (degrees). | |
| | | * @param[in] lat2 latitude of point 2 (degrees). | |
| | | * @param[in] lon2 longitude of point 2 (degrees). | |
| | | * @param[in] outmask a bitor'ed combination of Rhumb::mask values | |
| | | * specifying which of the following parameters should be set. | |
| | | * @param[out] s12 rhumb distance between point 1 and point 2 (meters). | |
| | | * @param[out] azi12 azimuth of the rhumb line (degrees). | |
| | | * @param[out] S12 area under the rhumb line (meters<sup>2</sup>). | |
| | | * | |
| | | * The Rhumb::mask values possible for \e outmask are | |
| | | * - \e outmask |= Rhumb::DISTANCE for the latitude \e s12; | |
| | | * - \e outmask |= Rhumb::AZIMUTH for the latitude \e azi12; | |
| | | * - \e outmask |= Rhumb::AREA for the area \e S12; | |
| | | * - \e outmask |= Rhumb::ALL for all of the above; | |
| | | ********************************************************************** | |
| | | / | |
| | | void GenInverse(real lat1, real lon1, real lat2, real lon2, | |
| | | unsigned outmask, | |
| | | real& s12, real& azi12, real& S12) const; | |
| | | | |
| /** | | /** | |
| * Set up to compute several points on a single rhumb line. | | * Set up to compute several points on a single rhumb line. | |
| * | | * | |
| * @param[in] lat1 latitude of point 1 (degrees). | | * @param[in] lat1 latitude of point 1 (degrees). | |
| * @param[in] lon1 longitude of point 1 (degrees). | | * @param[in] lon1 longitude of point 1 (degrees). | |
| * @param[in] azi12 azimuth of the rhumb line (degrees). | | * @param[in] azi12 azimuth of the rhumb line (degrees). | |
| * @return a RhumbLine object. | | * @return a RhumbLine object. | |
| * | | * | |
| * \e lat1 should be in the range [−90°, 90°]; \e lon1 an
d \e | | * \e lat1 should be in the range [−90°, 90°]; \e lon1 an
d \e | |
| | | | |
| skipping to change at line 251 | | skipping to change at line 431 | |
| * the value used in the constructor. | | * the value used in the constructor. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real MajorRadius() const { return _ell.MajorRadius(); } | | Math::real MajorRadius() const { return _ell.MajorRadius(); } | |
| | | | |
| /** | | /** | |
| * @return \e f the flattening of the ellipsoid. This is the | | * @return \e f the flattening of the ellipsoid. This is the | |
| * value used in the constructor. | | * value used in the constructor. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real Flattening() const { return _ell.Flattening(); } | | Math::real Flattening() const { return _ell.Flattening(); } | |
| | | | |
|
| | | Math::real EllipsoidArea() const { return _ell.Area(); } | |
| | | | |
| /** | | /** | |
| * A global instantiation of Rhumb with the parameters for the WGS84 | | * A global instantiation of Rhumb with the parameters for the WGS84 | |
| * ellipsoid. | | * ellipsoid. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| static const Rhumb& WGS84(); | | static const Rhumb& WGS84(); | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * \brief Find a sequence of points on a single rhumb line. | | * \brief Find a sequence of points on a single rhumb line. | |
| * | | * | |
| * RhumbLine facilitates the determination of a series of points on a sin
gle | | * RhumbLine facilitates the determination of a series of points on a sin
gle | |
| * rhumb line. The starting point (\e lat1, \e lon1) and the azimuth \e | | * rhumb line. The starting point (\e lat1, \e lon1) and the azimuth \e | |
| * azi12 are specified in the call to Rhumb::Line which returns a RhumbLi
ne | | * azi12 are specified in the call to Rhumb::Line which returns a RhumbLi
ne | |
|
| * object. RhumbLine.Position returns the location of point 2 a distance | | * object. RhumbLine.Position returns the location of point 2 (and, | |
| \e | | * optionally, the corresponding area, \e S12) a distance \e s12 along th | |
| * s12 along the rhumb line. | | e | |
| | | * rhumb line. | |
| | | * | |
| * There is no public constructor for this class. (Use Rhumb::Line to cr
eate | | * There is no public constructor for this class. (Use Rhumb::Line to cr
eate | |
| * an instance.) The Rhumb object used to create a RhumbLine must stay i
n | | * an instance.) The Rhumb object used to create a RhumbLine must stay i
n | |
| * scope as long as the RhumbLine. | | * scope as long as the RhumbLine. | |
| * | | * | |
| * Example of use: | | * Example of use: | |
| * \include example-RhumbLine.cpp | | * \include example-RhumbLine.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHICLIB_EXPORT RhumbLine { | | class GEOGRAPHICLIB_EXPORT RhumbLine { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| friend class Rhumb; | | friend class Rhumb; | |
| const Rhumb& _rh; | | const Rhumb& _rh; | |
| bool _exact; | | bool _exact; | |
| real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1; | | real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1; | |
| RhumbLine& operator=(const RhumbLine&); // copy assignment not allowed | | RhumbLine& operator=(const RhumbLine&); // copy assignment not allowed | |
| RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12, | | RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12, | |
| bool exact); | | bool exact); | |
| public: | | public: | |
|
| | | | |
| | | enum mask { | |
| | | /** | |
| | | * No output. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | NONE = Rhumb::NONE, | |
| | | /** | |
| | | * Calculate latitude \e lat2. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LATITUDE = Rhumb::LATITUDE, | |
| | | /** | |
| | | * Calculate longitude \e lon2. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LONGITUDE = Rhumb::LONGITUDE, | |
| | | /** | |
| | | * Calculate azimuth \e azi12. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | AZIMUTH = Rhumb::AZIMUTH, | |
| | | /** | |
| | | * Calculate distance \e s12. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | DISTANCE = Rhumb::DISTANCE, | |
| | | /** | |
| | | * Calculate area \e S12. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | AREA = Rhumb::AREA, | |
| | | /** | |
| | | * Do wrap the \e lon2 in the direct calculation. | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | LONG_NOWRAP = Rhumb::LONG_NOWRAP, | |
| | | /** | |
| | | * Calculate everything. (LONG_NOWRAP is not included in this mask.) | |
| | | * @hideinitializer | |
| | | ******************************************************************** | |
| | | **/ | |
| | | ALL = Rhumb::ALL, | |
| | | }; | |
| | | | |
| /** | | /** | |
| * Compute the position of point 2 which is a distance \e s12 (meters)
from | | * Compute the position of point 2 which is a distance \e s12 (meters)
from | |
|
| * point 1. | | * point 1. The area is also computed. | |
| * | | * | |
| * @param[in] s12 distance between point 1 and point 2 (meters); it can
be | | * @param[in] s12 distance between point 1 and point 2 (meters); it can
be | |
| * negative. | | * negative. | |
| * @param[out] lat2 latitude of point 2 (degrees). | | * @param[out] lat2 latitude of point 2 (degrees). | |
| * @param[out] lon2 longitude of point 2 (degrees). | | * @param[out] lon2 longitude of point 2 (degrees). | |
|
| | | * @param[out] S12 area under the rhumb line (meters<sup>2</sup>). | |
| * | | * | |
|
| * The values of \e lon2 and \e azi2 returned are in the range | | * The value of \e lon2 returned is in the range [−180°, | |
| * [−180°, 180°). | | * 180°). | |
| | | * | |
| | | * If \e s12 is large enough that the rhumb line crosses a pole, the | |
| | | * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 | |
| | | and | |
| | | * \e S12). | |
| | | ********************************************************************** | |
| | | / | |
| | | void Position(real s12, real& lat2, real& lon2, real& S12) const { | |
| | | GenPosition(s12, LATITUDE | LONGITUDE | AREA, lat2, lon2, S12); | |
| | | } | |
| | | | |
| | | /** | |
| | | * Compute the position of point 2 which is a distance \e s12 (meters) | |
| | | from | |
| | | * point 1. The area is not computed. | |
| | | ********************************************************************** | |
| | | / | |
| | | void Position(real s12, real& lat2, real& lon2) const { | |
| | | real t; | |
| | | GenPosition(s12, LATITUDE | LONGITUDE, lat2, lon2, t); | |
| | | } | |
| | | | |
| | | /** | |
| | | * The general position routine. RhumbLine::Position is defined in ter | |
| | | m so | |
| | | * this function. | |
| | | * | |
| | | * @param[in] s12 distance between point 1 and point 2 (meters); it can | |
| | | be | |
| | | * negative. | |
| | | * @param[in] outmask a bitor'ed combination of Rhumb::mask values | |
| | | * specifying which of the following parameters should be set. | |
| | | * @param[out] lat2 latitude of point 2 (degrees). | |
| | | * @param[out] lon2 longitude of point 2 (degrees). | |
| | | * @param[out] S12 area under the rhumb line (meters<sup>2</sup>). | |
| | | * | |
| | | * The Rhumb::mask values possible for \e outmask are | |
| | | * - \e outmask |= Rhumb::LATITUDE for the latitude \e lat2; | |
| | | * - \e outmask |= Rhumb::LONGITUDE for the latitude \e lon2; | |
| | | * - \e outmask |= Rhumb::AREA for the area \e S12; | |
| | | * - \e outmask |= Rhumb::ALL for all of the above; | |
| | | * - \e outmask |= Rhumb::LONG_NOWRAP stops the returned value of \e | |
| | | * lon2 being wrapped into the range [−180°, 180°). | |
| | | * . | |
| | | * With the LONG_NOWRAP bit set, the quantity \e lon2 − \e lon1 | |
| | | * indicates how many times the rhumb line wrapped around the ellipsoid | |
| | | . | |
| | | * Because \e lon2 might be outside the normal allowed range for | |
| | | * longitudes, [−540°, 540°), be sure to normalize it wit | |
| | | h | |
| | | * Math::AngNormalize2 before using it in other GeographicLib calls. | |
| * | | * | |
| * If \e s12 is large enough that the rhumb line crosses a pole, the | | * If \e s12 is large enough that the rhumb line crosses a pole, the | |
|
| * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 | | * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 | |
| ). | | and | |
| | | * \e S12). | |
| **********************************************************************
/ | | **********************************************************************
/ | |
|
| void Position(real s12, real& lat2, real& lon2) const; | | void GenPosition(real s12, unsigned outmask, | |
| | | real& lat2, real& lon2, real& S12) const; | |
| | | | |
| /** \name Inspector functions | | /** \name Inspector functions | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| ///@{ | | ///@{ | |
| | | | |
| /** | | /** | |
| * @return \e lat1 the latitude of point 1 (degrees). | | * @return \e lat1 the latitude of point 1 (degrees). | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real Latitude() const { return _lat1; } | | Math::real Latitude() const { return _lat1; } | |
| | | | |
| | | | |
End of changes. 31 change blocks. |
| 39 lines changed or deleted | | 354 lines changed or added | |
|