Accumulator.hpp   Accumulator.hpp 
skipping to change at line 29 skipping to change at line 29
* *
* This allow many numbers of floating point type \e T to be added togeth er * This allow many numbers of floating point type \e T to be added togeth er
* with twice the normal precision. Thus if \e T is double, the effectiv e * with twice the normal precision. Thus if \e T is double, the effectiv e
* precision of the sum is 106 bits or about 32 decimal places. The core * precision of the sum is 106 bits or about 32 decimal places. The core
* idea is the error free transformation of a sum, D. E. Knuth, TAOCP, Vo l 2, * idea is the error free transformation of a sum, D. E. Knuth, TAOCP, Vo l 2,
* 4.2.2, Theorem B. * 4.2.2, Theorem B.
* *
* The implementation follows J. R. Shewchuk, * The implementation follows J. R. Shewchuk,
* <a href="http://dx.doi.org/10.1007/PL00009321"> Adaptive Precision * <a href="http://dx.doi.org/10.1007/PL00009321"> Adaptive Precision
* Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>, * Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>,
* Discrete & Computational Geometry 18(3) 305&ndash;363 (1997). * Discrete & Computational Geometry 18(3) 305--363 (1997).
* *
* Approximate timings (summing a vector<double>) * Approximate timings (summing a vector<double>)
* - double: 2ns * - double: 2ns
* - Accumulator<double>: 23ns * - Accumulator<double>: 23ns
* *
* In the documentation of the member functions, \e sum stands for the va lue * In the documentation of the member functions, \e sum stands for the va lue
* currently held in the accumulator. * currently held in the accumulator.
* *
* Example of use: * Example of use:
* \include example-Accumulator.cpp * \include example-Accumulator.cpp
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 AlbersEqualArea.hpp   AlbersEqualArea.hpp 
skipping to change at line 25 skipping to change at line 25
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Albers equal area conic projection * \brief Albers equal area conic projection
* *
* Implementation taken from the report, * Implementation taken from the report,
* - J. P. Snyder, * - J. P. Snyder,
* <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection s: A * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection s: A
* Working Manual</a>, USGS Professional Paper 1395 (1987), * Working Manual</a>, USGS Professional Paper 1395 (1987),
* pp. 101&ndash;102. * pp. 101--102.
* *
* This is a implementation of the equations in Snyder except that divide d * This is a implementation of the equations in Snyder except that divide d
* differences will be [have been] used to transform the expressions into * differences will be [have been] used to transform the expressions into
* ones which may be evaluated accurately. [In this implementation, the * ones which may be evaluated accurately. [In this implementation, the
* projection correctly becomes the cylindrical equal area or the azimuth al * projection correctly becomes the cylindrical equal area or the azimuth al
* equal area projection when the standard latitude is the equator or a * equal area projection when the standard latitude is the equator or a
* pole.] * pole.]
* *
* The ellipsoid parameters, the standard parallels, and the scale on the * The ellipsoid parameters, the standard parallels, and the scale on the
* standard parallels are set in the constructor. Internally, the case w ith * standard parallels are set in the constructor. Internally, the case w ith
skipping to change at line 133 skipping to change at line 133
/** /**
* Constructor with a single standard parallel. * Constructor with a single standard parallel.
* *
* @param[in] a equatorial radius of ellipsoid (meters). * @param[in] a equatorial radius of ellipsoid (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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @param[in] stdlat standard parallel (degrees), the circle of tangenc y. * @param[in] stdlat standard parallel (degrees), the circle of tangenc y.
* @param[in] k0 azimuthal scale on the standard parallel. * @param[in] k0 azimuthal scale on the standard parallel.
* @exception GeographicLib if \e a, (1 &minus; \e f ) \e a, or \e k0 i s * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k0 i s
* not positive. * not positive.
* @exception GeographicErr if \e stdlat is not in [&minus;90&deg;, * @exception GeographicErr if \e stdlat is not in [&minus;90&deg;,
* 90&deg;]. * 90&deg;].
********************************************************************** / ********************************************************************** /
AlbersEqualArea(real a, real f, real stdlat, real k0); AlbersEqualArea(real a, real f, real stdlat, real k0);
/** /**
* Constructor with two standard parallels. * Constructor with two standard parallels.
* *
* @param[in] a equatorial radius of ellipsoid (meters). * @param[in] a equatorial radius of ellipsoid (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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat1 first standard parallel (degrees).
* @param[in] stdlat2 second standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees).
* @param[in] k1 azimuthal scale on the standard parallels. * @param[in] k1 azimuthal scale on the standard parallels.
* @exception GeographicLib if \e a, (1 &minus; \e f ) \e a, or \e k1 i s * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k1 i s
* not positive. * not positive.
* @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in
* [&minus;90&deg;, 90&deg;], or if \e stdlat1 and \e stdlat2 are * [&minus;90&deg;, 90&deg;], or if \e stdlat1 and \e stdlat2 are
* opposite poles. * opposite poles.
********************************************************************** / ********************************************************************** /
AlbersEqualArea(real a, real f, real stdlat1, real stdlat2, real k1); AlbersEqualArea(real a, real f, real stdlat1, real stdlat2, real k1);
/** /**
* Constructor with two standard parallels specified by sines and cosin es. * Constructor with two standard parallels specified by sines and cosin es.
* *
* @param[in] a equatorial radius of ellipsoid (meters). * @param[in] a equatorial radius of ellipsoid (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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @param[in] sinlat1 sine of first standard parallel. * @param[in] sinlat1 sine of first standard parallel.
* @param[in] coslat1 cosine of first standard parallel. * @param[in] coslat1 cosine of first standard parallel.
* @param[in] sinlat2 sine of second standard parallel. * @param[in] sinlat2 sine of second standard parallel.
* @param[in] coslat2 cosine of second standard parallel. * @param[in] coslat2 cosine of second standard parallel.
* @param[in] k1 azimuthal scale on the standard parallels. * @param[in] k1 azimuthal scale on the standard parallels.
* @exception GeographicLib if \e a, (1 &minus; \e f ) \e a, or \e k1 i s * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k1 i s
* not positive. * not positive.
* @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in
* [&minus;90&deg;, 90&deg;], or if \e stdlat1 and \e stdlat2 are * [&minus;90&deg;, 90&deg;], or if \e stdlat1 and \e stdlat2 are
* opposite poles. * opposite poles.
* *
* This allows parallels close to the poles to be specified accurately. * This allows parallels close to the poles to be specified accurately.
* This routine computes the latitude of origin and the azimuthal scale at * This routine computes the latitude of origin and the azimuthal scale at
* this latitude. If \e dlat = abs(\e lat2 &minus; \e lat1) &le; 160&d eg;, * this latitude. If \e dlat = abs(\e lat2 &minus; \e lat1) &le; 160&d eg;,
* then the error in the latitude of origin is less than 4.5 &times; * then the error in the latitude of origin is less than 4.5 &times;
* 10<sup>&minus;14</sup>d;. * 10<sup>&minus;14</sup>d;.
skipping to change at line 192 skipping to change at line 192
AlbersEqualArea(real a, real f, AlbersEqualArea(real a, real f,
real sinlat1, real coslat1, real sinlat1, real coslat1,
real sinlat2, real coslat2, real sinlat2, real coslat2,
real k1); real k1);
/** /**
* Set the azimuthal scale for the projection. * Set the azimuthal scale for the projection.
* *
* @param[in] lat (degrees). * @param[in] lat (degrees).
* @param[in] k azimuthal scale at latitude \e lat (default 1). * @param[in] k azimuthal scale at latitude \e lat (default 1).
* @exception GeographicLib \e k is not positive. * @exception GeographicErr \e k is not positive.
* @exception GeographicErr if \e lat is not in (&minus;90&deg;, * @exception GeographicErr if \e lat is not in (&minus;90&deg;,
* 90&deg;). * 90&deg;).
* *
* This allows a "latitude of conformality" to be specified. * This allows a "latitude of conformality" to be specified.
********************************************************************** / ********************************************************************** /
void SetScale(real lat, real k = real(1)); void SetScale(real lat, real k = real(1));
/** /**
* Forward projection, from geographic to Lambert conformal conic. * Forward projection, from geographic to Lambert conformal conic.
* *
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added


 Config.h   Config.h 
#define HAVE_LONG_DOUBLE 1 #define HAVE_LONG_DOUBLE 1
#define GEOGRAPHICLIB_VERSION_STRING "1.23" #define GEOGRAPHICLIB_VERSION_STRING "1.24"
/* # undef WORDS_BIGENDIAN */ /* # undef WORDS_BIGENDIAN */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 DMS.hpp   DMS.hpp 
skipping to change at line 144 skipping to change at line 144
* 0:5.5, and so on. The integer parts of the minutes and seconds * 0:5.5, and so on. The integer parts of the minutes and seconds
* components must be less than 60. A single leading sign is permitted . A * components must be less than 60. A single leading sign is permitted . A
* hemisphere designator (N, E, W, S) may be added to the beginning or end * hemisphere designator (N, E, W, S) may be added to the beginning or end
* of the string. The result is multiplied by the implied sign of the * of the string. The result is multiplied by the implied sign of the
* hemisphere designator (negative for S and W). In addition \e ind is set * hemisphere designator (negative for S and W). In addition \e ind is set
* to DMS::LATITUDE if N or S is present, to DMS::LONGITUDE if E or W i s * to DMS::LATITUDE if N or S is present, to DMS::LONGITUDE if E or W i s
* present, and to DMS::NONE otherwise. Throws an error on a malformed * present, and to DMS::NONE otherwise. Throws an error on a malformed
* string. No check is performed on the range of the result. Examples of * string. No check is performed on the range of the result. Examples of
* legal and illegal strings are * legal and illegal strings are
* - <i>LEGAL</i> (all the entries on each line are equivalent) * - <i>LEGAL</i> (all the entries on each line are equivalent)
* - -20.51125, 20d30'40.5&quot;S, -20d30'40.5, -20d30.675, * - -20.51125, 20d30'40.5&quot;S, -20&deg;30'40.5, -20d30.675,
* N-20d30'40.5&quot;, -20:30:40.5 * N-20d30'40.5&quot;, -20:30:40.5
* - 4d0'9, 4d9&quot;, 4d9'', 4:0:9, 004:00:09, 4.0025, 4.0025d, 4d0. 15, * - 4d0'9, 4d9&quot;, 4d9'', 4:0:9, 004:00:09, 4.0025, 4.0025d, 4d0. 15,
* 04:.15 * 04:.15
* - <i>ILLEGAL</i> (the exception thrown explains the problem) * - <i>ILLEGAL</i> (the exception thrown explains the problem)
* - 4d5&quot;4', 4::5, 4:5:, :4:5, 4d4.5'4&quot;, -N20.5, 1.8e2d, 4: 60, * - 4d5&quot;4', 4::5, 4:5:, :4:5, 4d4.5'4&quot;, -N20.5, 1.8e2d, 4: 60,
* 4d-5' * 4d-5'
* *
* <b>NOTE:</b> At present, all the string handling in the C++ * <b>NOTE:</b> At present, all the string handling in the C++
* implementation %GeographicLib is with 8-bit characters. The support for * implementation %GeographicLib is with 8-bit characters. The support for
* unicode symbols for degrees, minutes, and seconds is therefore via t he * unicode symbols for degrees, minutes, and seconds is therefore via t he
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 EllipticFunction.hpp   EllipticFunction.hpp 
skipping to change at line 31 skipping to change at line 31
* TransverseMercatorExact. For a given ellipsoid, only parameters * TransverseMercatorExact. For a given ellipsoid, only parameters
* <i>e</i><sup>2</sup> and 1 &minus; <i>e</i><sup>2</sup> are needed. T his * <i>e</i><sup>2</sup> and 1 &minus; <i>e</i><sup>2</sup> are needed. T his
* class taken the parameter as a constructor parameters and caches the * class taken the parameter as a constructor parameters and caches the
* values of the required complete integrals. A method is provided for * values of the required complete integrals. A method is provided for
* Jacobi elliptic functions and for the incomplete elliptic integral of the * Jacobi elliptic functions and for the incomplete elliptic integral of the
* second kind in terms of the amplitude. * second kind in terms of the amplitude.
* *
* The computation of the elliptic integrals uses the algorithms given in * The computation of the elliptic integrals uses the algorithms given in
* - B. C. Carlson, * - B. C. Carlson,
* <a href="http://dx.doi.org/10.1007/BF02198293"> Computation of ellip tic * <a href="http://dx.doi.org/10.1007/BF02198293"> Computation of ellip tic
* integrals</a>, Numerical Algorithms 10, 13&ndash;26 (1995). * integrals</a>, Numerical Algorithms 10, 13--26 (1995).
* . * .
* The computation of the Jacobi elliptic functions uses the algorithm gi ven * The computation of the Jacobi elliptic functions uses the algorithm gi ven
* in * in
* - R. Bulirsch, * - R. Bulirsch,
* <a href="http://dx.doi.org/10.1007/BF01397975"> Numerical Calculatio n of * <a href="http://dx.doi.org/10.1007/BF01397975"> Numerical Calculatio n of
* Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik 7, * Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik 7,
* 78&ndash;90 (1965). * 78--90 (1965).
* . * .
* The notation follows Abramowitz and Stegun, Chapters 16 and 17. * The notation follows Abramowitz and Stegun, Chapters 16 and 17.
* *
* Example of use: * Example of use:
* \include example-EllipticFunction.cpp * \include example-EllipticFunction.cpp
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT EllipticFunction { class GEOGRAPHIC_EXPORT EllipticFunction {
private: private:
typedef Math::real real; typedef Math::real real;
static const real tol_; static const real tol_;
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 GeoCoords.hpp   GeoCoords.hpp 
skipping to change at line 65 skipping to change at line 65
mutable real _alt_easting, _alt_northing, _alt_gamma, _alt_k; mutable real _alt_easting, _alt_northing, _alt_gamma, _alt_k;
mutable int _alt_zone; mutable int _alt_zone;
void CopyToAlt() const throw() { void CopyToAlt() const throw() {
_alt_easting = _easting; _alt_easting = _easting;
_alt_northing = _northing; _alt_northing = _northing;
_alt_gamma = _gamma; _alt_gamma = _gamma;
_alt_k = _k; _alt_k = _k;
_alt_zone = _zone; _alt_zone = _zone;
} }
void UTMUPSString(int zone, real easting, real northing, static void UTMUPSString(int zone, bool northp, real easting, real nort
int prec, std::string& utm) const; hing,
int prec, std::string& utm);
void FixHemisphere(); void FixHemisphere();
public: public:
/** \name Initializing the GeoCoords object /** \name Initializing the GeoCoords object
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* The default constructor is equivalent to \e latitude = 90&deg;, * The default constructor is equivalent to \e latitude = 90&deg;,
* \e longitude = 0&deg;. * \e longitude = 0&deg;.
********************************************************************** / ********************************************************************** /
skipping to change at line 120 skipping to change at line 120
* - 43:16:12E 33:26:24 * - 43:16:12E 33:26:24
* - MGRS * - MGRS
* - 38SLC301 * - 38SLC301
* - 38SLC391014 * - 38SLC391014
* - 38SLC3918701405 * - 38SLC3918701405
* - 37SHT9708 * - 37SHT9708
* - UTM * - UTM
* - 38N 339188 3701405 * - 38N 339188 3701405
* - 897039 3708229 37N * - 897039 3708229 37N
* *
* Latitude and Longitude parsing. Latitude precedes longitude, unless * <b>Latitude and Longitude parsing</b>: Latitude precedes longitude,
a * unless a N, S, E, W hemisphere designator is used on one or both
* N, S, E, W hemisphere designator is used on one or both coordinates. * coordinates. If \e swaplatlong = true (default is false), then
If * longitude precedes latitude in the absence of a hemisphere designato
* \e swaplatlong = true (default is false), then longitude precedes r.
* latitude in the absence of a hemisphere designator. Thus (with \e * Thus (with \e swaplatlong = false)
* swaplatlong = false)
* - 40 -75 * - 40 -75
* - N40 W75 * - N40 W75
* - -75 N40 * - -75 N40
* - 75W 40N * - 75W 40N
* - E-75 -40S * - E-75 -40S
* . * .
* are all the same position. The coordinates may be given in * are all the same position. The coordinates may be given in
* decimal degrees, degrees and decimal minutes, degrees, minutes, * decimal degrees, degrees and decimal minutes, degrees, minutes,
* seconds, etc. Use d, ', and &quot; to mark off the degrees, * seconds, etc. Use d, ', and &quot; to mark off the degrees,
* minutes and seconds. Alternatively, use : to separate these * minutes and seconds. Various alternative symbols for degrees, minut
* components. Thus es,
* and seconds are allowed. Alternatively, use : to separate these
* components. (See DMS::Decode for details.) Thus
* - 40d30'30&quot; * - 40d30'30&quot;
* - 40d30'30 * - 40d30'30
* - 40&deg;30'30
* - 40d30.5' * - 40d30.5'
* - 40d30.5 * - 40d30.5
* - 40:30:30 * - 40:30:30
* - 40:30.5 * - 40:30.5
* - 40.508333333 * - 40.508333333
* . * .
* all specify the same angle. The leading sign applies to all compone nts * all specify the same angle. The leading sign applies to all compone nts
* so -1d30 is -(1+30/60) = -1.5. Latitudes must be in the range * so -1d30 is -(1+30/60) = -1.5. Latitudes must be in the range
* [&minus;90&deg;, 90&deg;] and longitudes in the range * [&minus;90&deg;, 90&deg;] and longitudes in the range
* [&minus;540&deg;, 540&deg;). Internally longitudes are reduced * [&minus;540&deg;, 540&deg;). Internally longitudes are reduced
* to the range [&minus;180&deg;, 180&deg;). * to the range [&minus;180&deg;, 180&deg;).
* *
* UTM/UPS parsing. For UTM zones (&minus;80&deg; &le; Lat < 84&deg;), * <b>UTM/UPS parsing</b>: For UTM zones (&minus;80&deg; &le; Lat <
the * 84&deg;), the zone designator is made up of a zone number (for 1 to
* zone designator is made up of a zone number (for 1 to 60) and a 60)
* hemisphere letter (N or S), e.g., 38N. The latitude zone designer * and a hemisphere letter (N or S), e.g., 38N. The latitude zone desi
* ([C&ndash;M] in the southern hemisphere and [N&ndash;X] in the north gner
ern) * ([C--M] in the southern hemisphere and [N--X] in the northern) shoul
* should NOT be used. (This is part of the MGRS coordinate.) The zon d
e * NOT be used. (This is part of the MGRS coordinate.) The zone
* designator for the poles (where UPS is employed) is a hemisphere let ter * designator for the poles (where UPS is employed) is a hemisphere let ter
* by itself, i.e., N or S. * by itself, i.e., N or S.
* *
* MGRS parsing interprets the grid references as square area at the * <b>MGRS parsing</b> interprets the grid references as square area at the
* specified precision (1m, 10m, 100m, etc.). If \e centerp = true (th e * specified precision (1m, 10m, 100m, etc.). If \e centerp = true (th e
* default), the center of this square is then taken to be the precise * default), the center of this square is then taken to be the precise
* position; thus: * position; thus:
* - 38SMB = 38N 450000 3650000 * - 38SMB = 38N 450000 3650000
* - 38SMB4484 = 38N 444500 3684500 * - 38SMB4484 = 38N 444500 3684500
* - 38SMB44148470 = 38N 444145 3684705 * - 38SMB44148470 = 38N 444145 3684705
* . * .
* Otherwise, the "south-west" corner of the square is used, i.e., * Otherwise, the "south-west" corner of the square is used, i.e.,
* - 38SMB = 38N 400000 3600000 * - 38SMB = 38N 400000 3600000
* - 38SMB4484 = 38N 444000 3684000 * - 38SMB4484 = 38N 444000 3684000
skipping to change at line 479 skipping to change at line 481
* - prec = &minus;5 (min), 100km * - prec = &minus;5 (min), 100km
* - prec = &minus;3, 1km * - prec = &minus;3, 1km
* - prec = 0, 1m * - prec = 0, 1m
* - prec = 3, 1mm * - prec = 3, 1mm
* - prec = 6, 1&mu;m * - prec = 6, 1&mu;m
* - prec = 9 (max), 1nm * - prec = 9 (max), 1nm
********************************************************************** / ********************************************************************** /
std::string UTMUPSRepresentation(int prec = 0) const; std::string UTMUPSRepresentation(int prec = 0) const;
/** /**
* UTM/UPS string with hemisphere override.
*
* @param[in] prec precision (relative to about 1m)
* @param[in] northp hemisphere override
* @exception GeographicErr if the hemisphere override attempts to chan
ge
* UPS N to UPS S or vice verse.
* @exception std::bad_alloc if memory for the string can't be allocate
d.
* @return UTM/UPS string representation: zone designator, easting, and
* northing.
**********************************************************************
/
std::string UTMUPSRepresentation(bool northp, int prec = 0) const;
/**
* MGRS string for the alternate zone. See GeoCoords::MGRSRepresentati on. * MGRS string for the alternate zone. See GeoCoords::MGRSRepresentati on.
* *
* @param[in] prec precision (relative to about 1m). * @param[in] prec precision (relative to about 1m).
* @exception std::bad_alloc if memory for the string can't be allocate d. * @exception std::bad_alloc if memory for the string can't be allocate d.
* @return MGRS string. * @return MGRS string.
********************************************************************** / ********************************************************************** /
std::string AltMGRSRepresentation(int prec = 0) const; std::string AltMGRSRepresentation(int prec = 0) const;
/** /**
* UTM/UPS string for the alternate zone. See * UTM/UPS string for the alternate zone. See
* GeoCoords::UTMUPSRepresentation. * GeoCoords::UTMUPSRepresentation.
* *
* @param[in] prec precision (relative to about 1m) * @param[in] prec precision (relative to about 1m)
* @exception std::bad_alloc if memory for the string can't be allocate d. * @exception std::bad_alloc if memory for the string can't be allocate d.
* @return UTM/UPS string representation: zone designator, easting, and * @return UTM/UPS string representation: zone designator, easting, and
* northing. * northing.
********************************************************************** / ********************************************************************** /
std::string AltUTMUPSRepresentation(int prec = 0) const; std::string AltUTMUPSRepresentation(int prec = 0) const;
/**
* UTM/UPS string for the alternate zone, with hemisphere override.
*
* @param[in] prec precision (relative to about 1m)
* @param[in] northp hemisphere override
* @exception GeographicErr if the hemisphere override attempts to chan
ge
* UPS N to UPS S or vice verse.
* @exception std::bad_alloc if memory for the string can't be allocate
d.
* @return UTM/UPS string representation: zone designator, easting, and
* northing.
**********************************************************************
/
std::string AltUTMUPSRepresentation(bool northp, int prec = 0) const;
///@} ///@}
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
* *
* (The WGS84 value is returned because the UTM and UPS projections are * (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.) * based on this ellipsoid.)
 End of changes. 8 change blocks. 
20 lines changed or deleted 55 lines changed or added


 Geocentric.hpp   Geocentric.hpp 
skipping to change at line 35 skipping to change at line 35
* coordinates is at the center of the earth. The \e Z axis goes thru th e * coordinates is at the center of the earth. The \e Z axis goes thru th e
* north pole, \e lat = 90&deg;. The \e X axis goes thru \e lat = 0, * north pole, \e lat = 90&deg;. The \e X axis goes thru \e lat = 0,
* \e lon = 0. %Geocentric coordinates are also known as earth centered, * \e lon = 0. %Geocentric coordinates are also known as earth centered,
* earth fixed (ECEF) coordinates. * earth fixed (ECEF) coordinates.
* *
* The conversion from geographic to geocentric coordinates is * The conversion from geographic to geocentric coordinates is
* straightforward. For the reverse transformation we use * straightforward. For the reverse transformation we use
* - H. Vermeille, * - H. Vermeille,
* <a href="http://dx.doi.org/10.1007/s00190-002-0273-6"> Direct * <a href="http://dx.doi.org/10.1007/s00190-002-0273-6"> Direct
* transformation from geocentric coordinates to geodetic coordinates</ a>, * transformation from geocentric coordinates to geodetic coordinates</ a>,
* J. Geodesy 76, 451&ndash;454 (2002). * J. Geodesy 76, 451--454 (2002).
* . * .
* Several changes have been made to ensure that the method returns accur ate * Several changes have been made to ensure that the method returns accur ate
* results for all finite inputs (even if \e h is infinite). The changes are * results for all finite inputs (even if \e h is infinite). The changes are
* described in Appendix B of * described in Appendix B of
* - C. F. F. Karney, * - C. F. F. Karney,
* <a href="http://arxiv.org/abs/1102.1215v1">Geodesics * <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
* on an ellipsoid of revolution</a>, * on an ellipsoid of revolution</a>,
* Feb. 2011; * Feb. 2011;
* preprint * preprint
* <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>. * <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
skipping to change at line 109 skipping to change at line 109
public: public:
/** /**
* 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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @exception GeographicLib if \e a or (1 &minus; \e f ) \e a is not * @exception GeographicErr if \e a or (1 &minus; \e f ) \e a is not
* positive. * positive.
********************************************************************** / ********************************************************************** /
Geocentric(real a, real f); Geocentric(real a, real f);
/** /**
* A default constructor (for use by NormalGravity). * A default constructor (for use by NormalGravity).
********************************************************************** / ********************************************************************** /
Geocentric() : _a(-1) {} Geocentric() : _a(-1) {}
/** /**
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 Geodesic.hpp   Geodesic.hpp 
skipping to change at line 292 skipping to change at line 292
/** \name Constructor /** \name Constructor
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* 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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @exception GeographicLib if \e a or (1 &minus; \e f ) \e a is not * @exception GeographicErr if \e a or (1 &minus; \e f ) \e a is not
* positive. * positive.
********************************************************************** / ********************************************************************** /
Geodesic(real a, real f); Geodesic(real a, real f);
///@} ///@}
/** \name Direct geodesic problem specified in terms of distance. /** \name Direct geodesic problem specified in terms of distance.
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* Perform the direct geodesic calculation where the length of the geod esic * Perform the direct geodesic calculation where the length of the geod esic
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 Gnomonic.hpp   Gnomonic.hpp 
skipping to change at line 86 skipping to change at line 86
* This was proposed by independently by Bowring and Williams in 1997. * This was proposed by independently by Bowring and Williams in 1997.
* - Project to the conformal sphere with the constant of integration cho sen * - Project to the conformal sphere with the constant of integration cho sen
* so that the values of the latitude match for the center point and * so that the values of the latitude match for the center point and
* perform a central projection onto the plane tangent to the conformal * perform a central projection onto the plane tangent to the conformal
* sphere at the center point. This causes normal sections through the * sphere at the center point. This causes normal sections through the
* center point to appear as straight lines in the projection; i.e., it * center point to appear as straight lines in the projection; i.e., it
* generalizes the spherical great circle to a normal section. This wa s * generalizes the spherical great circle to a normal section. This wa s
* proposed by I. G. Letoval'tsev, Generalization of the %Gnomonic * proposed by I. G. Letoval'tsev, Generalization of the %Gnomonic
* Projection for a Spheroid and the Principal Geodetic Problems Involv ed * Projection for a Spheroid and the Principal Geodetic Problems Involv ed
* in the Alignment of Surface Routes, Geodesy and Aerophotography (5), * in the Alignment of Surface Routes, Geodesy and Aerophotography (5),
* 271&ndash;274 (1963). * 271--274 (1963).
* - The projection given here. This causes geodesics close to the cente r * - The projection given here. This causes geodesics close to the cente r
* point to appear as straight lines in the projection; i.e., it * point to appear as straight lines in the projection; i.e., it
* generalizes the spherical great circle to a geodesic. * generalizes the spherical great circle to a geodesic.
* *
* Example of use: * Example of use:
* \include example-Gnomonic.cpp * \include example-Gnomonic.cpp
* *
* <a href="GeodesicProj.1.html">GeodesicProj</a> is a command-line utili ty * <a href="GeodesicProj.1.html">GeodesicProj</a> is a command-line utili ty
* providing access to the functionality of AzimuthalEquidistant, Gnomoni c, * providing access to the functionality of AzimuthalEquidistant, Gnomoni c,
* and CassiniSoldner. * and CassiniSoldner.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 GravityCircle.hpp   GravityCircle.hpp 
skipping to change at line 56 skipping to change at line 56
NONE = GravityModel::NONE, NONE = GravityModel::NONE,
GRAVITY = GravityModel::GRAVITY, GRAVITY = GravityModel::GRAVITY,
DISTURBANCE = GravityModel::DISTURBANCE, DISTURBANCE = GravityModel::DISTURBANCE,
DISTURBING_POTENTIAL = GravityModel::DISTURBING_POTENTIAL, DISTURBING_POTENTIAL = GravityModel::DISTURBING_POTENTIAL,
GEOID_HEIGHT = GravityModel::GEOID_HEIGHT, GEOID_HEIGHT = GravityModel::GEOID_HEIGHT,
SPHERICAL_ANOMALY = GravityModel::SPHERICAL_ANOMALY, SPHERICAL_ANOMALY = GravityModel::SPHERICAL_ANOMALY,
ALL = GravityModel::ALL, ALL = GravityModel::ALL,
}; };
unsigned _caps; unsigned _caps;
real _a, _f, _lat, _h, _Z, _P, _invR, _cpsi, _spsi, real _a, _f, _lat, _h, _Z, _Px, _invR, _cpsi, _spsi,
_cphi, _sphi, _amodel, _GMmodel, _dzonal0, _cphi, _sphi, _amodel, _GMmodel, _dzonal0,
_corrmult, _gamma0, _gamma, _frot; _corrmult, _gamma0, _gamma, _frot;
CircularEngine _gravitational, _disturbing, _correction; CircularEngine _gravitational, _disturbing, _correction;
GravityCircle(mask caps, real a, real f, real lat, real h, GravityCircle(mask caps, real a, real f, real lat, real h,
real Z, real P, real cphi, real sphi, real Z, real P, real cphi, real sphi,
real amodel, real GMmodel, real dzonal0, real corrmult, real amodel, real GMmodel, real dzonal0, real corrmult,
real gamma0, real gamma, real frot, real gamma0, real gamma, real frot,
const CircularEngine& gravitational, const CircularEngine& gravitational,
const CircularEngine& disturbing, const CircularEngine& disturbing,
const CircularEngine& correction) const CircularEngine& correction)
: _caps(caps) : _caps(caps)
, _a(a) , _a(a)
, _f(f) , _f(f)
, _lat(lat) , _lat(lat)
, _h(h) , _h(h)
, _Z(Z) , _Z(Z)
, _P(P) , _Px(P)
, _invR(Math::hypot(_P, _Z)) , _invR(Math::hypot(_Px, _Z))
, _cpsi(_P * _invR) , _cpsi(_Px * _invR)
, _spsi(_Z * _invR) , _spsi(_Z * _invR)
, _cphi(cphi) , _cphi(cphi)
, _sphi(sphi) , _sphi(sphi)
, _amodel(amodel) , _amodel(amodel)
, _GMmodel(GMmodel) , _GMmodel(GMmodel)
, _dzonal0(dzonal0) , _dzonal0(dzonal0)
, _corrmult(corrmult) , _corrmult(corrmult)
, _gamma0(gamma0) , _gamma0(gamma0)
, _gamma(gamma) , _gamma(gamma)
, _frot(frot) , _frot(frot)
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 GravityModel.hpp   GravityModel.hpp 
skipping to change at line 95 skipping to change at line 95
class GEOGRAPHIC_EXPORT GravityModel { class GEOGRAPHIC_EXPORT GravityModel {
private: private:
typedef Math::real real; typedef Math::real real;
friend class GravityCircle; friend class GravityCircle;
static const int idlength_ = 8; static const int idlength_ = 8;
std::string _name, _dir, _description, _date, _filename, _id; std::string _name, _dir, _description, _date, _filename, _id;
real _amodel, _GMmodel, _zeta0, _corrmult; real _amodel, _GMmodel, _zeta0, _corrmult;
SphericalHarmonic::normalization _norm; SphericalHarmonic::normalization _norm;
NormalGravity _earth; NormalGravity _earth;
std::vector<real> _C, _S, _CC, _CS, _zonal; std::vector<real> _Cx, _Sx, _CC, _CS, _zonal;
real _dzonal0; // A left over contribution to _zonal. real _dzonal0; // A left over contribution to _zonal.
SphericalHarmonic _gravitational; SphericalHarmonic _gravitational;
SphericalHarmonic1 _disturbing; SphericalHarmonic1 _disturbing;
SphericalHarmonic _correction; SphericalHarmonic _correction;
void ReadMetadata(const std::string& name); void ReadMetadata(const std::string& name);
Math::real InternalT(real X, real Y, real Z, Math::real InternalT(real X, real Y, real Z,
real& deltaX, real& deltaY, real& deltaZ, real& deltaX, real& deltaY, real& deltaZ,
bool gradp, bool correct) const throw(); bool gradp, bool correct) const throw();
enum captype { enum captype {
CAP_NONE = 0U, CAP_NONE = 0U,
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 LambertConformalConic.hpp   LambertConformalConic.hpp 
skipping to change at line 25 skipping to change at line 25
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Lambert conformal conic projection * \brief Lambert conformal conic projection
* *
* Implementation taken from the report, * Implementation taken from the report,
* - J. P. Snyder, * - J. P. Snyder,
* <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection s: A * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection s: A
* Working Manual</a>, USGS Professional Paper 1395 (1987), * Working Manual</a>, USGS Professional Paper 1395 (1987),
* pp. 107&ndash;109. * pp. 107--109.
* *
* This is a implementation of the equations in Snyder except that divide d * This is a implementation of the equations in Snyder except that divide d
* differences have been used to transform the expressions into ones whic h * differences have been used to transform the expressions into ones whic h
* may be evaluated accurately and that Newton's method is used to invert the * may be evaluated accurately and that Newton's method is used to invert the
* projection. In this implementation, the projection correctly becomes the * projection. In this implementation, the projection correctly becomes the
* Mercator projection or the polar stereographic projection when the * Mercator projection or the polar stereographic projection when the
* standard latitude is the equator or a pole. The accuracy of the * standard latitude is the equator or a pole. The accuracy of the
* projections is about 10 nm (10 nanometers). * projections is about 10 nm (10 nanometers).
* *
* The ellipsoid parameters, the standard parallels, and the scale on the * The ellipsoid parameters, the standard parallels, and the scale on the
skipping to change at line 149 skipping to change at line 149
/** /**
* Constructor with a single standard parallel. * Constructor with a single standard parallel.
* *
* @param[in] a equatorial radius of ellipsoid (meters). * @param[in] a equatorial radius of ellipsoid (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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @param[in] stdlat standard parallel (degrees), the circle of tangenc y. * @param[in] stdlat standard parallel (degrees), the circle of tangenc y.
* @param[in] k0 scale on the standard parallel. * @param[in] k0 scale on the standard parallel.
* @exception GeographicLib if \e a, (1 &minus; \e f ) \e a, or \e k0 i s * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k0 i s
* not positive. * not positive.
* @exception GeographicErr if \e stdlat is not in [&minus;90&deg;, * @exception GeographicErr if \e stdlat is not in [&minus;90&deg;,
* 90&deg;]. * 90&deg;].
********************************************************************** / ********************************************************************** /
LambertConformalConic(real a, real f, real stdlat, real k0); LambertConformalConic(real a, real f, real stdlat, real k0);
/** /**
* Constructor with two standard parallels. * Constructor with two standard parallels.
* *
* @param[in] a equatorial radius of ellipsoid (meters). * @param[in] a equatorial radius of ellipsoid (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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat1 first standard parallel (degrees).
* @param[in] stdlat2 second standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees).
* @param[in] k1 scale on the standard parallels. * @param[in] k1 scale on the standard parallels.
* @exception GeographicLib if \e a, (1 &minus; \e f ) \e a, or \e k1 i s * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k1 i s
* not positive. * not positive.
* @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in
* [&minus;90&deg;, 90&deg;], or if either \e stdlat1 or \e * [&minus;90&deg;, 90&deg;], or if either \e stdlat1 or \e
* stdlat2 is a pole and \e stdlat1 is not equal \e stdlat2. * stdlat2 is a pole and \e stdlat1 is not equal \e stdlat2.
********************************************************************** / ********************************************************************** /
LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1); LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1);
/** /**
* Constructor with two standard parallels specified by sines and cosin es. * Constructor with two standard parallels specified by sines and cosin es.
* *
* @param[in] a equatorial radius of ellipsoid (meters). * @param[in] a equatorial radius of ellipsoid (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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @param[in] sinlat1 sine of first standard parallel. * @param[in] sinlat1 sine of first standard parallel.
* @param[in] coslat1 cosine of first standard parallel. * @param[in] coslat1 cosine of first standard parallel.
* @param[in] sinlat2 sine of second standard parallel. * @param[in] sinlat2 sine of second standard parallel.
* @param[in] coslat2 cosine of second standard parallel. * @param[in] coslat2 cosine of second standard parallel.
* @param[in] k1 scale on the standard parallels. * @param[in] k1 scale on the standard parallels.
* @exception GeographicLib if \e a, (1 &minus; \e f ) \e a, or \e k1 i s * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k1 i s
* not positive. * not positive.
* @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in
* [&minus;90&deg;, 90&deg;], or if either \e stdlat1 or \e * [&minus;90&deg;, 90&deg;], or if either \e stdlat1 or \e
* stdlat2 is a pole and \e stdlat1 is not equal \e stdlat2. * stdlat2 is a pole and \e stdlat1 is not equal \e stdlat2.
* *
* This allows parallels close to the poles to be specified accurately. * This allows parallels close to the poles to be specified accurately.
* This routine computes the latitude of origin and the scale at this * This routine computes the latitude of origin and the scale at this
* latitude. In the case where \e lat1 and \e lat2 are different, the * latitude. In the case where \e lat1 and \e lat2 are different, the
* errors in this routines are as follows: if \e dlat = abs(\e lat2 &mi nus; * errors in this routines are as follows: if \e dlat = abs(\e lat2 &mi nus;
* \e lat1) &le; 160&deg; and max(abs(\e lat1), abs(\e lat2)) &le; 90 * \e lat1) &le; 160&deg; and max(abs(\e lat1), abs(\e lat2)) &le; 90
skipping to change at line 213 skipping to change at line 213
LambertConformalConic(real a, real f, LambertConformalConic(real a, real f,
real sinlat1, real coslat1, real sinlat1, real coslat1,
real sinlat2, real coslat2, real sinlat2, real coslat2,
real k1); real k1);
/** /**
* Set the scale for the projection. * Set the scale for the projection.
* *
* @param[in] lat (degrees). * @param[in] lat (degrees).
* @param[in] k scale at latitude \e lat (default 1). * @param[in] k scale at latitude \e lat (default 1).
* @exception GeographicLib \e k is not positive. * @exception GeographicErr \e k is not positive.
* @exception GeographicErr if \e lat is not in [&minus;90&deg;, * @exception GeographicErr if \e lat is not in [&minus;90&deg;,
* 90&deg;]. * 90&deg;].
********************************************************************** / ********************************************************************** /
void SetScale(real lat, real k = real(1)); void SetScale(real lat, real k = real(1));
/** /**
* Forward projection, from geographic to Lambert conformal conic. * Forward projection, from geographic to Lambert conformal conic.
* *
* @param[in] lon0 central meridian longitude (degrees). * @param[in] lon0 central meridian longitude (degrees).
* @param[in] lat latitude of point (degrees). * @param[in] lat latitude of point (degrees).
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added


 MGRS.hpp   MGRS.hpp 
skipping to change at line 183 skipping to change at line 183
* them \e within the allowed range. (This includes reducing a souther n * them \e within the allowed range. (This includes reducing a souther n
* hemisphere northing of 10000 km by 4 nm so that it is placed in lati tude * hemisphere northing of 10000 km by 4 nm so that it is placed in lati tude
* band M.) The UTM or UPS coordinates are truncated to requested * band M.) The UTM or UPS coordinates are truncated to requested
* precision to determine the MGRS coordinate. Thus in UTM zone 38N, t he * precision to determine the MGRS coordinate. Thus in UTM zone 38N, t he
* square area with easting in [444 km, 445 km) and northing in [3688 k m, * square area with easting in [444 km, 445 km) and northing in [3688 k m,
* 3689 km) maps to MGRS coordinate 38SMB4488 (at \e prec = 2, 1 km), * 3689 km) maps to MGRS coordinate 38SMB4488 (at \e prec = 2, 1 km),
* Khulani Sq., Baghdad. * Khulani Sq., Baghdad.
* *
* The UTM/UPS selection and the UTM zone is preserved in the conversio n to * The UTM/UPS selection and the UTM zone is preserved in the conversio n to
* MGRS coordinate. Thus for \e zone > 0, the MGRS coordinate begins w ith * MGRS coordinate. Thus for \e zone > 0, the MGRS coordinate begins w ith
* the zone number followed by one of [C&ndash;M] for the southern * the zone number followed by one of [C--M] for the southern
* hemisphere and [N&ndash;X] for the northern hemisphere. For \e zone * hemisphere and [N--X] for the northern hemisphere. For \e zone =
=
* 0, the MGRS coordinates begins with one of [AB] for the southern * 0, the MGRS coordinates begins with one of [AB] for the southern
* hemisphere and [XY] for the northern hemisphere. * hemisphere and [XY] for the northern hemisphere.
* *
* The conversion to the MGRS is exact for prec in [0, 5] except that a * The conversion to the MGRS is exact for prec in [0, 5] except that a
* neighboring latitude band letter may be given if the point is within 5nm * neighboring latitude band letter may be given if the point is within 5nm
* of a band boundary. For prec in [6, 11], the conversion is accurate to * of a band boundary. For prec in [6, 11], the conversion is accurate to
* roundoff. * roundoff.
* *
* If \e x or \e y is NaN or if \e zone is UTMUPS::INVALID, the returne d * If \e x or \e y is NaN or if \e zone is UTMUPS::INVALID, the returne d
* MGRS string is "INVALID". * MGRS string is "INVALID".
skipping to change at line 243 skipping to change at line 243
* @param[out] x easting of point (meters). * @param[out] x easting of point (meters).
* @param[out] y northing of point (meters). * @param[out] y northing of point (meters).
* @param[out] prec precision relative to 100 km. * @param[out] prec precision relative to 100 km.
* @param[in] centerp if true (default), return center of the MGRS squa re, * @param[in] centerp if true (default), return center of the MGRS squa re,
* else return SW (lower left) corner. * else return SW (lower left) corner.
* @exception GeographicErr if \e mgrs is illegal. * @exception GeographicErr if \e mgrs is illegal.
* *
* All conversions from MGRS to UTM/UPS are permitted provided the MGRS * All conversions from MGRS to UTM/UPS are permitted provided the MGRS
* coordinate is a possible result of a conversion in the other directi on. * coordinate is a possible result of a conversion in the other directi on.
* (The leading 0 may be dropped from an input MGRS coordinate for UTM * (The leading 0 may be dropped from an input MGRS coordinate for UTM
* zones 1&ndash;9.) In addition, MGRS coordinates with a neighboring * zones 1--9.) In addition, MGRS coordinates with a neighboring
* latitude band letter are permitted provided that some portion of the * latitude band letter are permitted provided that some portion of the
* 100 km block is within the given latitude band. Thus * 100 km block is within the given latitude band. Thus
* - 38VLS and 38WLS are allowed (latitude 64N intersects the square * - 38VLS and 38WLS are allowed (latitude 64N intersects the square
* 38[VW]LS); but 38VMS is not permitted (all of 38VMS is north of 64N) * 38[VW]LS); but 38VMS is not permitted (all of 38VMS is north of 64N)
* - 38MPE and 38NPF are permitted (they straddle the equator); but 3 8NPE * - 38MPE and 38NPF are permitted (they straddle the equator); but 3 8NPE
* and 38MPF are not permitted (the equator does not intersect eith er * and 38MPF are not permitted (the equator does not intersect eith er
* block). * block).
* - Similarly ZAB and YZB are permitted (they straddle the prime * - Similarly ZAB and YZB are permitted (they straddle the prime
* meridian); but YAB and ZZB are not (the prime meridian does not * meridian); but YAB and ZZB are not (the prime meridian does not
* intersect either block). * intersect either block).
 End of changes. 2 change blocks. 
4 lines changed or deleted 3 lines changed or added


 Math.hpp   Math.hpp 
skipping to change at line 32 skipping to change at line 32
# define GEOGRAPHICLIB_CPLUSPLUS11_MATH 1 # define GEOGRAPHICLIB_CPLUSPLUS11_MATH 1
# else # else
# define GEOGRAPHICLIB_CPLUSPLUS11_MATH 0 # define GEOGRAPHICLIB_CPLUSPLUS11_MATH 0
# endif # endif
#endif #endif
#if !defined(WORDS_BIGENDIAN) #if !defined(WORDS_BIGENDIAN)
# define WORDS_BIGENDIAN 0 # define WORDS_BIGENDIAN 0
#endif #endif
#if !defined(HAVE_LONG_DOUBLE)
# define HAVE_LONG_DOUBLE 0
#endif
#if !defined(GEOGRAPHICLIB_PREC) #if !defined(GEOGRAPHICLIB_PREC)
/** /**
* The precision of floating point numbers used in %GeographicLib. 0 means * The precision of floating point numbers used in %GeographicLib. 0 means
* float; 1 (default) means double; 2 means long double. Nearly all the * float; 1 (default) means double; 2 means long double. Nearly all the
* testing has been carried out with doubles and that's the recommended * testing has been carried out with doubles and that's the recommended
* configuration. In order for long double to be used, HAVE_LONG_DOUBLE ne eds * configuration. In order for long double to be used, HAVE_LONG_DOUBLE ne eds
* to be defined. Note that with Microsoft Visual Studio, long double is t he * to be defined. Note that with Microsoft Visual Studio, long double is t he
* same as double. * same as double.
**********************************************************************/ **********************************************************************/
# define GEOGRAPHICLIB_PREC 1 # define GEOGRAPHICLIB_PREC 1
skipping to change at line 70 skipping to change at line 74
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT Math { class GEOGRAPHIC_EXPORT Math {
private: private:
void dummy() { void dummy() {
STATIC_ASSERT(GEOGRAPHICLIB_PREC >= 0 && GEOGRAPHICLIB_PREC <= 2, STATIC_ASSERT(GEOGRAPHICLIB_PREC >= 0 && GEOGRAPHICLIB_PREC <= 2,
"Bad value of precision"); "Bad value of precision");
} }
Math(); // Disable constructor Math(); // Disable constructor
public: public:
#if defined(HAVE_LONG_DOUBLE) #if HAVE_LONG_DOUBLE
/** /**
* The extended precision type for real numbers, used for some testing. * The extended precision type for real numbers, used for some testing.
* This is long double on computers with this type; otherwise it is dou ble. * This is long double on computers with this type; otherwise it is dou ble.
********************************************************************** / ********************************************************************** /
typedef long double extended; typedef long double extended;
#else #else
typedef double extended; typedef double extended;
#endif #endif
#if GEOGRAPHICLIB_PREC == 1 #if GEOGRAPHICLIB_PREC == 1
skipping to change at line 163 skipping to change at line 167
static inline double hypot(double x, double y) throw() static inline double hypot(double x, double y) throw()
{ return _hypot(x, y); } { return _hypot(x, y); }
# if _MSC_VER < 1400 # if _MSC_VER < 1400
// Visual C++ 7.1/VS .NET 2003 does not have _hypotf() // Visual C++ 7.1/VS .NET 2003 does not have _hypotf()
static inline float hypot(float x, float y) throw() static inline float hypot(float x, float y) throw()
{ return float(_hypot(x, y)); } { return float(_hypot(x, y)); }
# else # else
static inline float hypot(float x, float y) throw() static inline float hypot(float x, float y) throw()
{ return _hypotf(x, y); } { return _hypotf(x, y); }
# endif # endif
# if defined(HAVE_LONG_DOUBLE) # if HAVE_LONG_DOUBLE
static inline long double hypot(long double x, long double y) throw() static inline long double hypot(long double x, long double y) throw()
{ return _hypot(x, y); } { return _hypot(x, y); }
# endif # endif
#else #else
// Use overloading to define generic versions // Use overloading to define generic versions
static inline double hypot(double x, double y) throw() static inline double hypot(double x, double y) throw()
{ return ::hypot(x, y); } { return ::hypot(x, y); }
static inline float hypot(float x, float y) throw() static inline float hypot(float x, float y) throw()
{ return ::hypotf(x, y); } { return ::hypotf(x, y); }
# if defined(HAVE_LONG_DOUBLE) # if HAVE_LONG_DOUBLE
static inline long double hypot(long double x, long double y) throw() static inline long double hypot(long double x, long double y) throw()
{ return ::hypotl(x, y); } { return ::hypotl(x, y); }
# endif # endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH)
/** /**
* exp(\e x) &minus; 1 accurate near \e x = 0. This is taken from * exp(\e x) &minus; 1 accurate near \e x = 0. This is taken from
* N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd * N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd
* Edition (SIAM, 2002), Sec 1.14.1, p 19. * Edition (SIAM, 2002), Sec 1.14.1, p 19.
skipping to change at line 205 skipping to change at line 209
// 1)/log(y) is a slowly varying quantity near y = 1 and is accuratel y // 1)/log(y) is a slowly varying quantity near y = 1 and is accuratel y
// computed. // computed.
return std::abs(x) > 1 ? z : (z == 0 ? x : x * z / std::log(y)); return std::abs(x) > 1 ? z : (z == 0 ? x : x * z / std::log(y));
} }
#elif GEOGRAPHICLIB_CPLUSPLUS11_MATH #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
template<typename T> static inline T expm1(T x) throw() template<typename T> static inline T expm1(T x) throw()
{ return std::expm1(x); } { return std::expm1(x); }
#else #else
static inline double expm1(double x) throw() { return ::expm1(x); } static inline double expm1(double x) throw() { return ::expm1(x); }
static inline float expm1(float x) throw() { return ::expm1f(x); } static inline float expm1(float x) throw() { return ::expm1f(x); }
# if defined(HAVE_LONG_DOUBLE) # if HAVE_LONG_DOUBLE
static inline long double expm1(long double x) throw() static inline long double expm1(long double x) throw()
{ return ::expm1l(x); } { return ::expm1l(x); }
# endif # endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH)
/** /**
* log(1 + \e x) accurate near \e x = 0. * log(1 + \e x) accurate near \e x = 0.
* *
* This is taken from D. Goldberg, * This is taken from D. Goldberg,
skipping to change at line 240 skipping to change at line 244
// a good approximation to the true log(1 + x)/x. The multiplication x * // a good approximation to the true log(1 + x)/x. The multiplication x *
// (log(y)/z) introduces little additional error. // (log(y)/z) introduces little additional error.
return z == 0 ? x : x * std::log(y) / z; return z == 0 ? x : x * std::log(y) / z;
} }
#elif GEOGRAPHICLIB_CPLUSPLUS11_MATH #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
template<typename T> static inline T log1p(T x) throw() template<typename T> static inline T log1p(T x) throw()
{ return std::log1p(x); } { return std::log1p(x); }
#else #else
static inline double log1p(double x) throw() { return ::log1p(x); } static inline double log1p(double x) throw() { return ::log1p(x); }
static inline float log1p(float x) throw() { return ::log1pf(x); } static inline float log1p(float x) throw() { return ::log1pf(x); }
# if defined(HAVE_LONG_DOUBLE) # if HAVE_LONG_DOUBLE
static inline long double log1p(long double x) throw() static inline long double log1p(long double x) throw()
{ return ::log1pl(x); } { return ::log1pl(x); }
# endif # endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH)
/** /**
* The inverse hyperbolic sine function. This is defined in terms of * The inverse hyperbolic sine function. This is defined in terms of
* Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In * Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In
* addition, the odd parity of the function is enforced. * addition, the odd parity of the function is enforced.
skipping to change at line 267 skipping to change at line 271
T y = std::abs(x); // Enforce odd parity T y = std::abs(x); // Enforce odd parity
y = log1p(y * (1 + y/(hypot(T(1), y) + 1))); y = log1p(y * (1 + y/(hypot(T(1), y) + 1)));
return x < 0 ? -y : y; return x < 0 ? -y : y;
} }
#elif GEOGRAPHICLIB_CPLUSPLUS11_MATH #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
template<typename T> static inline T asinh(T x) throw() template<typename T> static inline T asinh(T x) throw()
{ return std::asinh(x); } { return std::asinh(x); }
#else #else
static inline double asinh(double x) throw() { return ::asinh(x); } static inline double asinh(double x) throw() { return ::asinh(x); }
static inline float asinh(float x) throw() { return ::asinhf(x); } static inline float asinh(float x) throw() { return ::asinhf(x); }
# if defined(HAVE_LONG_DOUBLE) # if HAVE_LONG_DOUBLE
static inline long double asinh(long double x) throw() static inline long double asinh(long double x) throw()
{ return ::asinhl(x); } { return ::asinhl(x); }
# endif # endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH)
/** /**
* The inverse hyperbolic tangent function. This is defined in terms o f * The inverse hyperbolic tangent function. This is defined in terms o f
* Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In * Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In
* addition, the odd parity of the function is enforced. * addition, the odd parity of the function is enforced.
skipping to change at line 294 skipping to change at line 298
T y = std::abs(x); // Enforce odd parity T y = std::abs(x); // Enforce odd parity
y = log1p(2 * y/(1 - y))/2; y = log1p(2 * y/(1 - y))/2;
return x < 0 ? -y : y; return x < 0 ? -y : y;
} }
#elif GEOGRAPHICLIB_CPLUSPLUS11_MATH #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
template<typename T> static inline T atanh(T x) throw() template<typename T> static inline T atanh(T x) throw()
{ return std::atanh(x); } { return std::atanh(x); }
#else #else
static inline double atanh(double x) throw() { return ::atanh(x); } static inline double atanh(double x) throw() { return ::atanh(x); }
static inline float atanh(float x) throw() { return ::atanhf(x); } static inline float atanh(float x) throw() { return ::atanhf(x); }
# if defined(HAVE_LONG_DOUBLE) # if HAVE_LONG_DOUBLE
static inline long double atanh(long double x) throw() static inline long double atanh(long double x) throw()
{ return ::atanhl(x); } { return ::atanhl(x); }
# endif # endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MA TH)
/** /**
* The cube root function. * The cube root function.
* *
* @tparam T the type of the argument and the returned value. * @tparam T the type of the argument and the returned value.
skipping to change at line 318 skipping to change at line 322
template<typename T> static inline T cbrt(T x) throw() { template<typename T> static inline T cbrt(T x) throw() {
T y = std::pow(std::abs(x), 1/T(3)); // Return the real cube root T y = std::pow(std::abs(x), 1/T(3)); // Return the real cube root
return x < 0 ? -y : y; return x < 0 ? -y : y;
} }
#elif GEOGRAPHICLIB_CPLUSPLUS11_MATH #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
template<typename T> static inline T cbrt(T x) throw() template<typename T> static inline T cbrt(T x) throw()
{ return std::cbrt(x); } { return std::cbrt(x); }
#else #else
static inline double cbrt(double x) throw() { return ::cbrt(x); } static inline double cbrt(double x) throw() { return ::cbrt(x); }
static inline float cbrt(float x) throw() { return ::cbrtf(x); } static inline float cbrt(float x) throw() { return ::cbrtf(x); }
# if defined(HAVE_LONG_DOUBLE) # if HAVE_LONG_DOUBLE
static inline long double cbrt(long double x) throw() { return ::cbrtl( x); } static inline long double cbrt(long double x) throw() { return ::cbrtl( x); }
# endif # endif
#endif #endif
/** /**
* Normalize an angle (restricted input range). * Normalize an angle (restricted input range).
* *
* @tparam T the type of the argument and returned value. * @tparam T the type of the argument and returned value.
* @param[in] x the angle in degrees. * @param[in] x the angle in degrees.
* @return the angle reduced to the range [&minus;180&deg;, * @return the angle reduced to the range [&minus;180&deg;,
 End of changes. 9 change blocks. 
8 lines changed or deleted 12 lines changed or added


 PolarStereographic.hpp   PolarStereographic.hpp 
skipping to change at line 24 skipping to change at line 24
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Polar stereographic projection * \brief Polar stereographic projection
* *
* Implementation taken from the report, * Implementation taken from the report,
* - J. P. Snyder, * - J. P. Snyder,
* <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection s: A * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection s: A
* Working Manual</a>, USGS Professional Paper 1395 (1987), * Working Manual</a>, USGS Professional Paper 1395 (1987),
* pp. 160&ndash;163. * pp. 160--163.
* *
* This is a straightforward implementation of the equations in Snyder ex cept * This is a straightforward implementation of the equations in Snyder ex cept
* that Newton's method is used to invert the projection. * that Newton's method is used to invert the projection.
* *
* Example of use: * Example of use:
* \include example-PolarStereographic.cpp * \include example-PolarStereographic.cpp
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT PolarStereographic { class GEOGRAPHIC_EXPORT PolarStereographic {
private: private:
typedef Math::real real; typedef Math::real real;
skipping to change at line 62 skipping to change at line 62
public: public:
/** /**
* 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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @param[in] k0 central scale factor. * @param[in] k0 central scale factor.
* @exception GeographicLib if \e a, (1 &minus; \e f ) \e a, or \e k0 i s * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k0 i s
* not positive. * not positive.
********************************************************************** / ********************************************************************** /
PolarStereographic(real a, real f, real k0); PolarStereographic(real a, real f, real k0);
/** /**
* Set the scale for the projection. * Set the scale for the projection.
* *
* @param[in] lat (degrees) assuming \e northp = true. * @param[in] lat (degrees) assuming \e northp = true.
* @param[in] k scale at latitude \e lat (default 1). * @param[in] k scale at latitude \e lat (default 1).
* @exception GeographicLib \e k is not positive. * @exception GeographicErr \e k is not positive.
* @exception GeographicErr if \e lat is not in (&minus;90&deg;, * @exception GeographicErr if \e lat is not in (&minus;90&deg;,
* 90&deg;]. * 90&deg;].
********************************************************************** / ********************************************************************** /
void SetScale(real lat, real k = real(1)); void SetScale(real lat, real k = real(1));
/** /**
* Forward projection, from geographic to polar stereographic. * Forward projection, from geographic to polar stereographic.
* *
* @param[in] northp the pole which is the center of projection (true m eans * @param[in] northp the pole which is the center of projection (true m eans
* north, false means south). * north, false means south).
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 SphericalEngine.hpp   SphericalEngine.hpp 
skipping to change at line 93 skipping to change at line 93
* the coefficients are stored into a single structure. This allows a * the coefficients are stored into a single structure. This allows a
* vector of type SphericalEngine::coeff to be passed to * vector of type SphericalEngine::coeff to be passed to
* SphericalEngine::Value. This class also includes functions to aid * SphericalEngine::Value. This class also includes functions to aid
* indexing into \e C and \e S. * indexing into \e C and \e S.
* *
* The storage layout of the coefficients is documented in * The storage layout of the coefficients is documented in
* SphericalHarmonic and SphericalHarmonic::SphericalHarmonic. * SphericalHarmonic and SphericalHarmonic::SphericalHarmonic.
********************************************************************** / ********************************************************************** /
class GEOGRAPHIC_EXPORT coeff { class GEOGRAPHIC_EXPORT coeff {
private: private:
int _N, _nmx, _mmx; int _Nx, _nmx, _mmx;
std::vector<real>::const_iterator _Cnm; std::vector<real>::const_iterator _Cnm;
std::vector<real>::const_iterator _Snm; std::vector<real>::const_iterator _Snm;
public: public:
/** /**
* A default constructor * A default constructor
******************************************************************** **/ ******************************************************************** **/
coeff() coeff()
: _N(-1) : _Nx(-1)
, _nmx(-1) , _nmx(-1)
, _mmx(-1) , _mmx(-1)
, _Cnm(Z_.begin()) , _Cnm(Z_.begin())
, _Snm(Z_.begin()) {} , _Snm(Z_.begin()) {}
/** /**
* The general constructor. * The general constructor.
* *
* @param[in] C a vector of coefficients for the cosine terms. * @param[in] C a vector of coefficients for the cosine terms.
* @param[in] S a vector of coefficients for the sine terms. * @param[in] S a vector of coefficients for the sine terms.
* @param[in] N the degree giving storage layout for \e C and \e S. * @param[in] N the degree giving storage layout for \e C and \e S.
skipping to change at line 124 skipping to change at line 124
* @exception GeographicErr if \e N, \e nmx, and \e mmx do not satisf y * @exception GeographicErr if \e N, \e nmx, and \e mmx do not satisf y
* \e N &ge; \e nmx &ge; \e mmx &ge; &minus;1. * \e N &ge; \e nmx &ge; \e mmx &ge; &minus;1.
* @exception GeographicErr if \e C or \e S is not big enough to hold the * @exception GeographicErr if \e C or \e S is not big enough to hold the
* coefficients. * coefficients.
* @exception std::bad_alloc if the memory for the square root table * @exception std::bad_alloc if the memory for the square root table
* can't be allocated. * can't be allocated.
******************************************************************** **/ ******************************************************************** **/
coeff(const std::vector<real>& C, coeff(const std::vector<real>& C,
const std::vector<real>& S, const std::vector<real>& S,
int N, int nmx, int mmx) int N, int nmx, int mmx)
: _N(N) : _Nx(N)
, _nmx(nmx) , _nmx(nmx)
, _mmx(mmx) , _mmx(mmx)
, _Cnm(C.begin()) , _Cnm(C.begin())
, _Snm(S.begin()) , _Snm(S.begin())
{ {
if (!(_N >= _nmx && _nmx >= _mmx && _mmx >= -1)) if (!(_Nx >= _nmx && _nmx >= _mmx && _mmx >= -1))
throw GeographicErr("Bad indices for coeff"); throw GeographicErr("Bad indices for coeff");
if (!(index(_nmx, _mmx) < int(C.size()) && if (!(index(_nmx, _mmx) < int(C.size()) &&
index(_nmx, _mmx) < int(S.size()) + (_N + 1))) index(_nmx, _mmx) < int(S.size()) + (_Nx + 1)))
throw GeographicErr("Arrays too small in coeff"); throw GeographicErr("Arrays too small in coeff");
SphericalEngine::RootTable(_nmx); SphericalEngine::RootTable(_nmx);
} }
/** /**
* The constructor for full coefficient vectors. * The constructor for full coefficient vectors.
* *
* @param[in] C a vector of coefficients for the cosine terms. * @param[in] C a vector of coefficients for the cosine terms.
* @param[in] S a vector of coefficients for the sine terms. * @param[in] S a vector of coefficients for the sine terms.
* @param[in] N the maximum degree and order. * @param[in] N the maximum degree and order.
* @exception GeographicErr if \e N does not satisfy \e N &ge; &minus ;1. * @exception GeographicErr if \e N does not satisfy \e N &ge; &minus ;1.
* @exception GeographicErr if \e C or \e S is not big enough to hold the * @exception GeographicErr if \e C or \e S is not big enough to hold the
* coefficients. * coefficients.
* @exception std::bad_alloc if the memory for the square root table * @exception std::bad_alloc if the memory for the square root table
* can't be allocated. * can't be allocated.
******************************************************************** **/ ******************************************************************** **/
coeff(const std::vector<real>& C, coeff(const std::vector<real>& C,
const std::vector<real>& S, const std::vector<real>& S,
int N) int N)
: _N(N) : _Nx(N)
, _nmx(N) , _nmx(N)
, _mmx(N) , _mmx(N)
, _Cnm(C.begin()) , _Cnm(C.begin())
, _Snm(S.begin()) , _Snm(S.begin())
{ {
if (!(_N >= -1)) if (!(_Nx >= -1))
throw GeographicErr("Bad indices for coeff"); throw GeographicErr("Bad indices for coeff");
if (!(index(_nmx, _mmx) < int(C.size()) && if (!(index(_nmx, _mmx) < int(C.size()) &&
index(_nmx, _mmx) < int(S.size()) + (_N + 1))) index(_nmx, _mmx) < int(S.size()) + (_Nx + 1)))
throw GeographicErr("Arrays too small in coeff"); throw GeographicErr("Arrays too small in coeff");
SphericalEngine::RootTable(_nmx); SphericalEngine::RootTable(_nmx);
} }
/** /**
* @return \e N the degree giving storage layout for \e C and \e S. * @return \e N the degree giving storage layout for \e C and \e S.
******************************************************************** **/ ******************************************************************** **/
inline int N() const throw() { return _N; } inline int N() const throw() { return _Nx; }
/** /**
* @return \e nmx the maximum degree to be used. * @return \e nmx the maximum degree to be used.
******************************************************************** **/ ******************************************************************** **/
inline int nmx() const throw() { return _nmx; } inline int nmx() const throw() { return _nmx; }
/** /**
* @return \e mmx the maximum order to be used. * @return \e mmx the maximum order to be used.
******************************************************************** **/ ******************************************************************** **/
inline int mmx() const throw() { return _mmx; } inline int mmx() const throw() { return _mmx; }
/** /**
* The one-dimensional index into \e C and \e S. * The one-dimensional index into \e C and \e S.
* *
* @param[in] n the degree. * @param[in] n the degree.
* @param[in] m the order. * @param[in] m the order.
* @return the one-dimensional index. * @return the one-dimensional index.
******************************************************************** **/ ******************************************************************** **/
inline int index(int n, int m) const throw() inline int index(int n, int m) const throw()
{ return m * _N - m * (m - 1) / 2 + n; } { return m * _Nx - m * (m - 1) / 2 + n; }
/** /**
* An element of \e C. * An element of \e C.
* *
* @param[in] k the one-dimensional index. * @param[in] k the one-dimensional index.
* @return the value of the \e C coefficient. * @return the value of the \e C coefficient.
******************************************************************** **/ ******************************************************************** **/
inline Math::real Cv(int k) const { return *(_Cnm + k); } inline Math::real Cv(int k) const { return *(_Cnm + k); }
/** /**
* An element of \e S. * An element of \e S.
* *
* @param[in] k the one-dimensional index. * @param[in] k the one-dimensional index.
* @return the value of the \e S coefficient. * @return the value of the \e S coefficient.
******************************************************************** **/ ******************************************************************** **/
inline Math::real Sv(int k) const { return *(_Snm + (k - (_N + 1))); } inline Math::real Sv(int k) const { return *(_Snm + (k - (_Nx + 1))); }
/** /**
* An element of \e C with checking. * An element of \e C with checking.
* *
* @param[in] k the one-dimensional index. * @param[in] k the one-dimensional index.
* @param[in] n the requested degree. * @param[in] n the requested degree.
* @param[in] m the requested order. * @param[in] m the requested order.
* @param[in] f a multiplier. * @param[in] f a multiplier.
* @return the value of the \e C coefficient multiplied by \e f in \e n * @return the value of the \e C coefficient multiplied by \e f in \e n
* and \e m are in range else 0. * and \e m are in range else 0.
******************************************************************** **/ ******************************************************************** **/
skipping to change at line 223 skipping to change at line 223
* An element of \e S with checking. * An element of \e S with checking.
* *
* @param[in] k the one-dimensional index. * @param[in] k the one-dimensional index.
* @param[in] n the requested degree. * @param[in] n the requested degree.
* @param[in] m the requested order. * @param[in] m the requested order.
* @param[in] f a multiplier. * @param[in] f a multiplier.
* @return the value of the \e S coefficient multiplied by \e f in \e n * @return the value of the \e S coefficient multiplied by \e f in \e n
* and \e m are in range else 0. * and \e m are in range else 0.
******************************************************************** **/ ******************************************************************** **/
inline Math::real Sv(int k, int n, int m, real f) const inline Math::real Sv(int k, int n, int m, real f) const
{ return m > _mmx || n > _nmx ? 0 : *(_Snm + (k - (_N + 1))) * f; } { return m > _mmx || n > _nmx ? 0 : *(_Snm + (k - (_Nx + 1))) * f; }
/** /**
* The size of the coefficient vector for the cosine terms. * The size of the coefficient vector for the cosine terms.
* *
* @param[in] N the maximum degree. * @param[in] N the maximum degree.
* @param[in] M the maximum order. * @param[in] M the maximum order.
* @return the size of the vector of cosine terms as stored in column * @return the size of the vector of cosine terms as stored in column
* major order. * major order.
******************************************************************** **/ ******************************************************************** **/
static inline int Csize(int N, int M) throw() static inline int Csize(int N, int M) throw()
skipping to change at line 346 skipping to change at line 346
* @param[in] N the maximum degree to be used in SphericalEngine. * @param[in] N the maximum degree to be used in SphericalEngine.
* @exception std::bad_alloc if the memory for the square root table ca n't * @exception std::bad_alloc if the memory for the square root table ca n't
* be allocated. * be allocated.
* *
* Typically, there's no need for an end-user to call this routine, bec ause * Typically, there's no need for an end-user to call this routine, bec ause
* the constructors for SphericalEngine::coeff do so. However, since t his * the constructors for SphericalEngine::coeff do so. However, since t his
* updates a static table, there's a possible race condition in a * updates a static table, there's a possible race condition in a
* multi-threaded environment. Because this routine does nothing if th e * multi-threaded environment. Because this routine does nothing if th e
* table is already large enough, one way to avoid race conditions is t o * table is already large enough, one way to avoid race conditions is t o
* call this routine at program start up (when it's still single thread ed), * call this routine at program start up (when it's still single thread ed),
* supplying the largest degree that your program will use. E.g., * supplying the largest degree that your program will use. E.g., \cod
\code e
GeographicLib::SphericalEngine::RootTable(2190); GeographicLib::SphericalEngine::RootTable(2190);
\endcode \endcode
* suffices to accommodate extant magnetic and gravity models. * suffices to accommodate extant magnetic and gravity models.
********************************************************************** / ********************************************************************** /
static void RootTable(int N); static void RootTable(int N);
/** /**
* Clear the static table of square roots and release the memory. Call * Clear the static table of square roots and release the memory. Call
* this only when you are sure you no longer will be using SphericalEng ine. * this only when you are sure you no longer will be using SphericalEng ine.
* Your program will crash if you call SphericalEngine after calling th is * Your program will crash if you call SphericalEngine after calling th is
 End of changes. 13 change blocks. 
14 lines changed or deleted 14 lines changed or added


 SphericalHarmonic.hpp   SphericalHarmonic.hpp 
skipping to change at line 49 skipping to change at line 49
* - fully normalized denoted by SphericalHarmonic::FULL. * - fully normalized denoted by SphericalHarmonic::FULL.
* - Schmidt semi-normalized denoted by SphericalHarmonic::SCHMIDT. * - Schmidt semi-normalized denoted by SphericalHarmonic::SCHMIDT.
* *
* Clenshaw summation is used for the sums over both \e n and \e m. This * Clenshaw summation is used for the sums over both \e n and \e m. This
* allows the computation to be carried out without the need for any * allows the computation to be carried out without the need for any
* temporary arrays. See SphericalEngine.cpp for more information on the * temporary arrays. See SphericalEngine.cpp for more information on the
* implementation. * implementation.
* *
* References: * References:
* - C. W. Clenshaw, A note on the summation of Chebyshev series, * - C. W. Clenshaw, A note on the summation of Chebyshev series,
* %Math. Tables Aids Comput. 9(51), 118&ndash;120 (1955). * %Math. Tables Aids Comput. 9(51), 118--120 (1955).
* - R. E. Deakin, Derivatives of the earth's potentials, Geomatics * - R. E. Deakin, Derivatives of the earth's potentials, Geomatics
* Research Australasia 68, 31&ndash;60, (June 1998). * Research Australasia 68, 31--60, (June 1998).
* - W. A. Heiskanen and H. Moritz, Physical Geodesy, (Freeman, San * - W. A. Heiskanen and H. Moritz, Physical Geodesy, (Freeman, San
* Francisco, 1967). (See Sec. 1-14, for a definition of Pbar.) * Francisco, 1967). (See Sec. 1-14, for a definition of Pbar.)
* - S. A. Holmes and W. E. Featherstone, A unified approach to the Clens haw * - S. A. Holmes and W. E. Featherstone, A unified approach to the Clens haw
* summation and the recursive computation of very high degree and orde r * summation and the recursive computation of very high degree and orde r
* normalised associated Legendre functions, J. Geodesy 76(5), * normalised associated Legendre functions, J. Geodesy 76(5),
* 279&ndash;299 (2002). * 279--299 (2002).
* - C. C. Tscherning and K. Poder, Some geodetic applications of Clensha w * - C. C. Tscherning and K. Poder, Some geodetic applications of Clensha w
* summation, Boll. Geod. Sci. Aff. 41(4), 349&ndash;375 (1982). * summation, Boll. Geod. Sci. Aff. 41(4), 349--375 (1982).
* *
* Example of use: * Example of use:
* \include example-SphericalHarmonic.cpp * \include example-SphericalHarmonic.cpp
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT SphericalHarmonic { class GEOGRAPHIC_EXPORT SphericalHarmonic {
public: public:
/** /**
* Supported normalizations for the associated Legendre polynomials. * Supported normalizations for the associated Legendre polynomials.
********************************************************************** / ********************************************************************** /
skipping to change at line 292 skipping to change at line 292
* *
* SphericalHarmonic::operator()() exchanges the order of the sums in t he * SphericalHarmonic::operator()() exchanges the order of the sums in t he
* definition, i.e., &sum;<sub>n = 0..N</sub> &sum;<sub>m = 0..n</sub> * definition, i.e., &sum;<sub>n = 0..N</sub> &sum;<sub>m = 0..n</sub>
* becomes &sum;<sub>m = 0..N</sub> &sum;<sub>n = m..N</sub>. * becomes &sum;<sub>m = 0..N</sub> &sum;<sub>n = m..N</sub>.
* SphericalHarmonic::Circle performs the inner sum over degree \e n (w hich * SphericalHarmonic::Circle performs the inner sum over degree \e n (w hich
* entails about <i>N</i><sup>2</sup> operations). Calling * entails about <i>N</i><sup>2</sup> operations). Calling
* CircularEngine::operator()() on the returned object performs the out er * CircularEngine::operator()() on the returned object performs the out er
* sum over the order \e m (about \e N operations). * sum over the order \e m (about \e N operations).
* *
* Here's an example of computing the spherical sum at a sequence of * Here's an example of computing the spherical sum at a sequence of
* longitudes without using a CircularEngine object * longitudes without using a CircularEngine object \code
\code
SphericalHarmonic h(...); // Create the SphericalHarmonic object SphericalHarmonic h(...); // Create the SphericalHarmonic object
double r = 2, lat = 33, lon0 = 44, dlon = 0.01; double r = 2, lat = 33, lon0 = 44, dlon = 0.01;
double double
phi = lat * Math::degree<double>(), phi = lat * Math::degree<double>(),
z = r * sin(phi), p = r * cos(phi); z = r * sin(phi), p = r * cos(phi);
for (int i = 0; i <= 100; ++i) { for (int i = 0; i <= 100; ++i) {
real real
lon = lon0 + i * dlon, lon = lon0 + i * dlon,
lam = lon * Math::degree<double>(); lam = lon * Math::degree<double>();
std::cout << lon << " " << h(p * cos(lam), p * sin(lam), z) << "\n"; std::cout << lon << " " << h(p * cos(lam), p * sin(lam), z) << "\n";
} }
\endcode \endcode
* Here is the same calculation done using a CircularEngine object. Th is * Here is the same calculation done using a CircularEngine object. Th is
* will be about <i>N</i>/2 times faster. * will be about <i>N</i>/2 times faster. \code
\code
SphericalHarmonic h(...); // Create the SphericalHarmonic object SphericalHarmonic h(...); // Create the SphericalHarmonic object
double r = 2, lat = 33, lon0 = 44, dlon = 0.01; double r = 2, lat = 33, lon0 = 44, dlon = 0.01;
double double
phi = lat * Math::degree<double>(), phi = lat * Math::degree<double>(),
z = r * sin(phi), p = r * cos(phi); z = r * sin(phi), p = r * cos(phi);
CircularEngine c(h(p, z, false)); // Create the CircularEngine object CircularEngine c(h(p, z, false)); // Create the CircularEngine object
for (int i = 0; i <= 100; ++i) { for (int i = 0; i <= 100; ++i) {
real real
lon = lon0 + i * dlon; lon = lon0 + i * dlon;
std::cout << lon << " " << c(lon) << "\n"; std::cout << lon << " " << c(lon) << "\n";
 End of changes. 6 change blocks. 
8 lines changed or deleted 6 lines changed or added


 TransverseMercator.hpp   TransverseMercator.hpp 
skipping to change at line 39 skipping to change at line 39
* This uses Kr&uuml;ger's method which evaluates the projection and its * This uses Kr&uuml;ger's method which evaluates the projection and its
* inverse in terms of a series. See * inverse in terms of a series. See
* - L. Kr&uuml;ger, * - L. Kr&uuml;ger,
* <a href="http://dx.doi.org/10.2312/GFZ.b103-krueger28"> Konforme * <a href="http://dx.doi.org/10.2312/GFZ.b103-krueger28"> Konforme
* Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of the * Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of the
* ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New * ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New
* Series 52, 172 pp. (1912). * Series 52, 172 pp. (1912).
* - C. F. F. Karney, * - C. F. F. Karney,
* <a href="http://dx.doi.org/10.1007/s00190-011-0445-3"> * <a href="http://dx.doi.org/10.1007/s00190-011-0445-3">
* Transverse Mercator with an accuracy of a few nanometers,</a> * Transverse Mercator with an accuracy of a few nanometers,</a>
* J. Geodesy 85(8), 475&ndash;485 (Aug. 2011); * J. Geodesy 85(8), 475--485 (Aug. 2011);
* preprint * preprint
* <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>. * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
* *
* Kr&uuml;ger's method has been extended from 4th to 6th order. The max imum * Kr&uuml;ger's method has been extended from 4th to 6th order. The max imum
* error is 5 nm (5 nanometers), ground distance, for all positions withi n 35 * error is 5 nm (5 nanometers), ground distance, for all positions withi n 35
* degrees of the central meridian. The error in the convergence is 2 * degrees of the central meridian. The error in the convergence is 2
* &times; 10<sup>&minus;15</sup>&quot; and the relative error in the sca le * &times; 10<sup>&minus;15</sup>&quot; and the relative error in the sca le
* is 6 &minus; 10<sup>&minus;12</sup>%%. See Sec. 4 of * is 6 &minus; 10<sup>&minus;12</sup>%%. See Sec. 4 of
* <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for detai ls. * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for detai ls.
* The speed penalty in going to 6th order is only about 1%. * The speed penalty in going to 6th order is only about 1%.
skipping to change at line 114 skipping to change at line 114
public: public:
/** /**
* 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 flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* @param[in] k0 central scale factor. * @param[in] k0 central scale factor.
* @exception GeographicLib if \e a, (1 &minus; \e f ) \e a, or \e k0 i s * @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k0 i s
* not positive. * not positive.
********************************************************************** / ********************************************************************** /
TransverseMercator(real a, real f, real k0); TransverseMercator(real a, real f, real k0);
/** /**
* Forward projection, from geographic to transverse Mercator. * Forward projection, from geographic to transverse Mercator.
* *
* @param[in] lon0 central meridian of the projection (degrees). * @param[in] lon0 central meridian of the projection (degrees).
* @param[in] lat latitude of point (degrees). * @param[in] lat latitude of point (degrees).
* @param[in] lon longitude of point (degrees). * @param[in] lon longitude of point (degrees).
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 TransverseMercatorExact.hpp   TransverseMercatorExact.hpp 
skipping to change at line 33 skipping to change at line 33
* <a href="http://dx.doi.org/10.3138/X687-1574-4325-WM62"> Conformal * <a href="http://dx.doi.org/10.3138/X687-1574-4325-WM62"> Conformal
* Projections Based On Jacobian Elliptic Functions</a>, Part V of * Projections Based On Jacobian Elliptic Functions</a>, Part V of
* Conformal Projections Based on Elliptic Functions, * Conformal Projections Based on Elliptic Functions,
* (B. V. Gutsell, Toronto, 1976), 128pp., * (B. V. Gutsell, Toronto, 1976), 128pp.,
* ISBN: 0919870163 * ISBN: 0919870163
* (also appeared as: * (also appeared as:
* Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13). * Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13).
* - C. F. F. Karney, * - C. F. F. Karney,
* <a href="http://dx.doi.org/10.1007/s00190-011-0445-3"> * <a href="http://dx.doi.org/10.1007/s00190-011-0445-3">
* Transverse Mercator with an accuracy of a few nanometers,</a> * Transverse Mercator with an accuracy of a few nanometers,</a>
* J. Geodesy 85(8), 475&ndash;485 (Aug. 2011); * J. Geodesy 85(8), 475--485 (Aug. 2011);
* preprint * preprint
* <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>. * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
* *
* Lee gives the correct results for forward and reverse transformations * Lee gives the correct results for forward and reverse transformations
* subject to the branch cut rules (see the description of the \e extendp * subject to the branch cut rules (see the description of the \e extendp
* argument to the constructor). The maximum error is about 8 nm (8 * argument to the constructor). The maximum error is about 8 nm (8
* nanometers), ground distance, for the forward and reverse transformati ons. * nanometers), ground distance, for the forward and reverse transformati ons.
* The error in the convergence is 2 &times; 10<sup>&minus;15</sup>&quot; , * The error in the convergence is 2 &times; 10<sup>&minus;15</sup>&quot; ,
* the relative error in the scale is 7 &times; 10<sup>&minus;12</sup>%%. * the relative error in the scale is 7 &times; 10<sup>&minus;12</sup>%%.
* See Sec. 3 of * See Sec. 3 of
skipping to change at line 138 skipping to change at line 138
public: public:
/** /**
* 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. If \e f > 1, set flattening * @param[in] f flattening of ellipsoid. If \e f > 1, set flattening
* to 1/\e f. * to 1/\e f.
* @param[in] k0 central scale factor. * @param[in] k0 central scale factor.
* @param[in] extendp use extended domain. * @param[in] extendp use extended domain.
* @exception GeographicLib if \e a, \e f, or \e k0 is not positive. * @exception GeographicErr if \e a, \e f, or \e k0 is not positive.
* *
* The transverse Mercator projection has a branch point singularity at \e * The transverse Mercator projection has a branch point singularity at \e
* lat = 0 and \e lon &minus; \e lon0 = 90 (1 &minus; \e e) or (for * lat = 0 and \e lon &minus; \e lon0 = 90 (1 &minus; \e e) or (for
* TransverseMercatorExact::UTM) x = 18381 km, y = 0m. The \e extendp * TransverseMercatorExact::UTM) x = 18381 km, y = 0m. The \e extendp
* argument governs where the branch cut is placed. With \e extendp = * argument governs where the branch cut is placed. With \e extendp =
* false, the "standard" convention is followed, namely the cut is plac ed * false, the "standard" convention is followed, namely the cut is plac ed
* along \e x > 18381 km, \e y = 0m. Forward can be called with any \e lat * along \e x > 18381 km, \e y = 0m. Forward can be called with any \e lat
* and \e lon then produces the transformation shown in Lee, Fig 46. * and \e lon then produces the transformation shown in Lee, Fig 46.
* Reverse analytically continues this in the &plusmn; \e x direction. As * Reverse analytically continues this in the &plusmn; \e x direction. As
* a consequence, Reverse may map multiple points to the same geographi c * a consequence, Reverse may map multiple points to the same geographi c
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 UTMUPS.hpp   UTMUPS.hpp 
skipping to change at line 71 skipping to change at line 71
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT UTMUPS { class GEOGRAPHIC_EXPORT UTMUPS {
private: private:
typedef Math::real real; typedef Math::real real;
static const real falseeasting_[4]; static const real falseeasting_[4];
static const real falsenorthing_[4]; static const real falsenorthing_[4];
static const real mineasting_[4]; static const real mineasting_[4];
static const real maxeasting_[4]; static const real maxeasting_[4];
static const real minnorthing_[4]; static const real minnorthing_[4];
static const real maxnorthing_[4]; static const real maxnorthing_[4];
static const int epsg01N = 32601; // EPSG code for UTM 01N
static const int epsg60N = 32660; // EPSG code for UTM 60N
static const int epsgN = 32661; // EPSG code for UPS N
static const int epsg01S = 32701; // EPSG code for UTM 01N
static const int epsg60S = 32760; // EPSG code for UTM 60S
static const int epsgS = 32761; // EPSG code for UPS S
static real CentralMeridian(int zone) throw() static real CentralMeridian(int zone) throw()
{ return real(6 * zone - 183); } { return real(6 * zone - 183); }
static void CheckLatLon(real lat, real lon); static void CheckLatLon(real lat, real lon);
// Throw an error if easting or northing are outside standard ranges. If // Throw an error if easting or northing are outside standard ranges. If
// throwp = false, return bool instead. // throwp = false, return bool instead.
static bool CheckCoords(bool utmp, bool northp, real x, real y, static bool CheckCoords(bool utmp, bool northp, real x, real y,
bool msgrlimits = false, bool throwp = true); bool msgrlimits = false, bool throwp = true);
UTMUPS(); // Disable constructor UTMUPS(); // Disable constructor
public: public:
skipping to change at line 181 skipping to change at line 187
* @param[out] y northing of point (meters). * @param[out] y northing of point (meters).
* @param[out] gamma meridian convergence at point (degrees). * @param[out] gamma meridian convergence at point (degrees).
* @param[out] k scale of projection at point. * @param[out] k scale of projection at point.
* @param[in] setzone zone override (optional). * @param[in] setzone zone override (optional).
* @param[in] mgrslimits if true enforce the stricter MGRS limits on th e * @param[in] mgrslimits if true enforce the stricter MGRS limits on th e
* coordinates (default = false). * coordinates (default = false).
* @exception GeographicErr if \e lat is not in [&minus;90&deg;, * @exception GeographicErr if \e lat is not in [&minus;90&deg;,
* 90&deg;]. * 90&deg;].
* @exception GeographicErr if \e lon is not in [&minus;540&deg;, * @exception GeographicErr if \e lon is not in [&minus;540&deg;,
* 540&deg;). * 540&deg;).
* @exception GeographicLib if the resulting \e x or \e y is out of all owed * @exception GeographicErr if the resulting \e x or \e y is out of all owed
* range (see Reverse); in this case, these arguments are unchanged. * range (see Reverse); in this case, these arguments are unchanged.
* *
* If \e setzone is omitted, use the standard rules for picking the zon e. * If \e setzone is omitted, use the standard rules for picking the zon e.
* If \e setzone is given then use that zone if it is non-negative, * If \e setzone is given then use that zone if it is non-negative,
* otherwise apply the rules given in UTMUPS::zonespec. The accuracy o f * otherwise apply the rules given in UTMUPS::zonespec. The accuracy o f
* the conversion is about 5nm. * the conversion is about 5nm.
* *
* The northing \e y jumps by UTMUPS::UTMShift() when crossing the equa tor * The northing \e y jumps by UTMUPS::UTMShift() when crossing the equa tor
* in the southerly direction. Sometimes it is useful to remove this * in the southerly direction. Sometimes it is useful to remove this
* discontinuity in \e y by extending the "northern" hemisphere with * discontinuity in \e y by extending the "northern" hemisphere using
* UTMUPS::Transfer:
* \code * \code
double lat = -1, lon = 123; double lat = -1, lon = 123;
int zone; int zone;
bool northp; bool northp;
double x, y, gamma, k; double x, y, gamma, k;
GeographicLib::UTMUPS::Forward(lat, lon, zone, northp, x, y, gamma, k); GeographicLib::UTMUPS::Forward(lat, lon, zone, northp, x, y, gamma, k)
if (zone > 0 && !northp) { ;
northp = true; GeographicLib::UTMUPS::Transfer(zone, northp, x, y,
y -= GeographicLib::UTMUPS::UTMShift(); zone, true, x, y, zone);
} northp = true;
\endcode \endcode
********************************************************************** / ********************************************************************** /
static void Forward(real lat, real lon, static void Forward(real lat, real lon,
int& zone, bool& northp, real& x, real& y, int& zone, bool& northp, real& x, real& y,
real& gamma, real& k, real& gamma, real& k,
int setzone = STANDARD, bool mgrslimits = false); int setzone = STANDARD, bool mgrslimits = false);
/** /**
* Reverse projection, from UTM/UPS to geographic. * Reverse projection, from UTM/UPS to geographic.
* *
* @param[in] zone the UTM zone (zero means UPS). * @param[in] zone the UTM zone (zero means UPS).
* @param[in] northp hemisphere (true means north, false means south). * @param[in] northp hemisphere (true means north, false means south).
* @param[in] x easting of point (meters). * @param[in] x easting of point (meters).
* @param[in] y northing of point (meters). * @param[in] y northing of point (meters).
* @param[out] lat latitude of point (degrees). * @param[out] lat latitude of point (degrees).
* @param[out] lon longitude of point (degrees). * @param[out] lon longitude of point (degrees).
* @param[out] gamma meridian convergence at point (degrees). * @param[out] gamma meridian convergence at point (degrees).
* @param[out] k scale of projection at point. * @param[out] k scale of projection at point.
* @param[in] mgrslimits if true enforce the stricter MGRS limits on th e * @param[in] mgrslimits if true enforce the stricter MGRS limits on th e
* coordinates (default = false). * coordinates (default = false).
* @exception GeographicLib if \e zone, \e x, or \e y is out of allowed * @exception GeographicErr if \e zone, \e x, or \e y is out of allowed
* range; this this case the arguments are unchanged. * range; this this case the arguments are unchanged.
* *
* The accuracy of the conversion is about 5nm. * The accuracy of the conversion is about 5nm.
* *
* UTM eastings are allowed to be in the range [0km, 1000km], northings are * UTM eastings are allowed to be in the range [0km, 1000km], northings are
* allowed to be in in [0km, 9600km] for the northern hemisphere and in * allowed to be in in [0km, 9600km] for the northern hemisphere and in
* [900km, 10000km] for the southern hemisphere. However UTM northings * [900km, 10000km] for the southern hemisphere. However UTM northings
* can be continued across the equator. So the actual limits on the * can be continued across the equator. So the actual limits on the
* northings are [-9100km, 9600km] for the "northern" hemisphere and * northings are [-9100km, 9600km] for the "northern" hemisphere and
* [900km, 19600km] for the "southern" hemisphere. * [900km, 19600km] for the "southern" hemisphere.
skipping to change at line 270 skipping to change at line 276
/** /**
* UTMUPS::Reverse without returning convergence and scale. * UTMUPS::Reverse without returning convergence and scale.
********************************************************************** / ********************************************************************** /
static void Reverse(int zone, bool northp, real x, real y, static void Reverse(int zone, bool northp, real x, real y,
real& lat, real& lon, bool mgrslimits = false) { real& lat, real& lon, bool mgrslimits = false) {
real gamma, k; real gamma, k;
Reverse(zone, northp, x, y, lat, lon, gamma, k, mgrslimits); Reverse(zone, northp, x, y, lat, lon, gamma, k, mgrslimits);
} }
/** /**
* Transfer UTM/UPS coordinated from one zone to another.
*
* @param[in] zonein the UTM zone for \e xin and \e yin (or zero for UP
S);
* @param[in] northpin hemisphere for \e xin and \e yin (true means nor
th,
* false means south).
* @param[in] xin easting of point (meters) in \e zonein.
* @param[in] yin northing of point (meters) in \e zonein.
* @param[in] zoneout the requested UTM zone for \e xout and \e yout (o
r
* zero for UPS).
* @param[in] northpout hemisphere for \e xout output and \e yout.
* @param[out] xout easting of point (meters) in \e zoneout.
* @param[out] yout northing of point (meters) in \e zoneout.
* @param[out] zone the actual UTM zone for \e xout and \e yout (or zer
o
* for UPS); this equals \e zoneout if \e zoneout &ge; 0.
* @exception GeographicErr if \e zonein is out of range (see below).
* @exception GeographicErr if \e zoneout is out of range (see below).
* @exception GeographicErr if \e xin or \e yin fall outside their allo
wed
* ranges (see UTMUPS::Reverse).
* @exception GeographicErr if \e xout or \e yout fall outside their
* allowed ranges (see UTMUPS::Reverse).
*
* \e zonein must be in the range [UTMUPS::MINZONE, UTMUPS::MAXZONE] =
[0,
* 60] with \e zonein = UTMUPS::UPS, 0, indicating UPS. \e zonein may
* also be UTMUPS::INVALID.
*
* \e zoneout must be in the range [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZ
ONE]
* = [-4, 60]. If \e zoneout &lt; UTMUPS::MINZONE then the rules give
in
* the documentation of UTMUPS::zonespec are applied, and \e zone is se
t to
* the actual zone used for output.
**********************************************************************
/
static void Transfer(int zonein, bool northpin, real xin, real yin,
int zoneout, bool northpout, real& xout, real& you
t,
int& zone);
/**
* Decode a UTM/UPS zone string. * Decode a UTM/UPS zone string.
* *
* @param[in] zonestr string representation of zone and hemisphere. * @param[in] zonestr string representation of zone and hemisphere.
* @param[out] zone the UTM zone (zero means UPS). * @param[out] zone the UTM zone (zero means UPS).
* @param[out] northp hemisphere (true means north, false means south). * @param[out] northp hemisphere (true means north, false means south).
* @exception GeographicErr of \e zonestr is malformed. * @exception GeographicErr if \e zonestr is malformed.
* *
* For UTM, \e zonestr has the form of a zone number in the range * For UTM, \e zonestr has the form of a zone number in the range
* [UTMUPS::MINUTMZONE, UTMUPS::MAXUTMZONE] = [1, 60] followed by a * [UTMUPS::MINUTMZONE, UTMUPS::MAXUTMZONE] = [1, 60] followed by a
* hemisphere letter, N or S. For UPS, it consists just of the hemisph ere * hemisphere letter, N or S. For UPS, it consists just of the hemisph ere
* letter. The returned value of \e zone is UTMUPS::UPS = 0 for UPS. Note * letter. The returned value of \e zone is UTMUPS::UPS = 0 for UPS. Note
* well that "38S" indicates the southern hemisphere of zone 38 and not * well that "38S" indicates the southern hemisphere of zone 38 and not
* latitude band S, [32, 40]. N, 01S, 2N, 38S are legal. 0N, 001S, 61 N, * latitude band S, [32, 40]. N, 01S, 2N, 38S are legal. 0N, 001S, 61 N,
* 38P are illegal. INV is a special value for which the returned valu e of * 38P are illegal. INV is a special value for which the returned valu e of
* \e is UTMUPS::INVALID. * \e is UTMUPS::INVALID.
********************************************************************** / ********************************************************************** /
static void DecodeZone(const std::string& zonestr, int& zone, bool& nor thp); static void DecodeZone(const std::string& zonestr, int& zone, bool& nor thp);
/** /**
* Encode a UTM/UPS zone string. * Encode a UTM/UPS zone string.
* *
* @param[out] zone the UTM zone (zero means UPS). * @param[in] zone the UTM zone (zero means UPS).
* @param[out] northp hemisphere (true means north, false means south). * @param[in] northp hemisphere (true means north, false means south).
* @exception GeographicErr of \e zone is out of range (see below). * @exception GeographicErr if \e zone is out of range (see below).
* @exception std::bad_alloc if memoy for the string can't be allocated . * @exception std::bad_alloc if memoy for the string can't be allocated .
* @return string representation of zone and hemisphere. * @return string representation of zone and hemisphere.
* *
* \e zone must be in the range [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0 , * \e zone must be in the range [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0 ,
* 60] with \e zone = UTMUPS::UPS, 0, indicating UPS (but the resulting * 60] with \e zone = UTMUPS::UPS, 0, indicating UPS (but the resulting
* string does not contain "0"). \e zone may also be UTMUPS::INVALID, in * string does not contain "0"). \e zone may also be UTMUPS::INVALID, in
* which case the returned string is "INV". This reverses * which case the returned string is "INV". This reverses
* UTMUPS::DecodeZone. * UTMUPS::DecodeZone.
********************************************************************** / ********************************************************************** /
static std::string EncodeZone(int zone, bool northp); static std::string EncodeZone(int zone, bool northp);
/** /**
* Decode EPSG.
*
* @param[in] epsg the EPSG code.
* @param[out] zone the UTM zone (zero means UPS).
* @param[out] northp hemisphere (true means north, false means south).
*
* EPSG (European Petroleum Survery Group) codes are a way to refer to
many
* different projections. DecodeEPSG decodes those refering to UTM or
UPS
* projections for the WGS84 ellipsoid. If the code does not refer to
one
* of these projections, \e zone is set to UTMUPS::INVALID. See
* http://spatialreference.org/ref/epsg/
**********************************************************************
/
static void DecodeEPSG(int& epsg, int& zone, bool& northp) throw();
/**
* Encode zone as EPSG.
*
* @param[in] zone the UTM zone (zero means UPS).
* @param[in] northp hemisphere (true means north, false means south).
* @return EPSG code (or -1 if \e zone is not in the range
* [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0, 60])
*
* Convert \e zone and \e northp to the corresponding EPSG (European
* Petroleum Survery Group) codes
**********************************************************************
/
static int EncodeEPSG(int zone, bool northp) throw();
/**
* @return shift (meters) necessary to align N and S halves of a UTM zo ne * @return shift (meters) necessary to align N and S halves of a UTM zo ne
* (10<sup>7</sup>). * (10<sup>7</sup>).
********************************************************************** / ********************************************************************** /
static Math::real UTMShift() throw(); static Math::real UTMShift() throw();
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
 End of changes. 9 change blocks. 
16 lines changed or deleted 102 lines changed or added


 Utility.hpp   Utility.hpp 
skipping to change at line 209 skipping to change at line 209
} }
y = y1; m = m1; d = d1; y = y1; m = m1; d = d1;
} }
/** /**
* Given the date, return the day of the week. * Given the date, return the day of the week.
* *
* @param[in] y the year (must be positive). * @param[in] y the year (must be positive).
* @param[in] m the month, Jan = 1, etc. (must be positive). * @param[in] m the month, Jan = 1, etc. (must be positive).
* @param[in] d the day of the month (must be positive). * @param[in] d the day of the month (must be positive).
* @return the day of the week with Sunday, Monday&ndash;Saturday = 0, * @return the day of the week with Sunday, Monday--Saturday = 0,
* 1&ndash;6. * 1--6.
********************************************************************** / ********************************************************************** /
static int dow(int y, int m, int d) throw() { return dow(day(y, m, d)); } static int dow(int y, int m, int d) throw() { return dow(day(y, m, d)); }
/** /**
* Given the sequential day, return the day of the week. * Given the sequential day, return the day of the week.
* *
* @param[in] s the sequential day (must be positive). * @param[in] s the sequential day (must be positive).
* @return the day of the week with Sunday, Monday&ndash;Saturday = 0, * @return the day of the week with Sunday, Monday--Saturday = 0,
* 1&ndash;6. * 1--6.
********************************************************************** / ********************************************************************** /
static int dow(int s) throw() { static int dow(int s) throw() {
return (s + 5) % 7; // The 5 offset makes day 1 (0001-01-01) a Satur day. return (s + 5) % 7; // The 5 offset makes day 1 (0001-01-01) a Satur day.
} }
/** /**
* Convert a string representing a date to a fractional year. * Convert a string representing a date to a fractional year.
* *
* @tparam T the type of the argument. * @tparam T the type of the argument.
* @param[in] s the string to be converted. * @param[in] s the string to be converted.
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/