GeographicLib  1.48
PolarStereographic.hpp
Go to the documentation of this file.
1 /**
2  * \file PolarStereographic.hpp
3  * \brief Header for GeographicLib::PolarStereographic class
4  *
5  * Copyright (c) Charles Karney (2008-2016) <charles@karney.com> and licensed
6  * under the MIT/X11 License. For more information, see
7  * https://geographiclib.sourceforge.io/
8  **********************************************************************/
9 
10 #if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP)
11 #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP 1
12 
14 
15 namespace GeographicLib {
16 
17  /**
18  * \brief Polar stereographic projection
19  *
20  * Implementation taken from the report,
21  * - J. P. Snyder,
22  * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projections: A
23  * Working Manual</a>, USGS Professional Paper 1395 (1987),
24  * pp. 160--163.
25  *
26  * This is a straightforward implementation of the equations in Snyder except
27  * that Newton's method is used to invert the projection.
28  *
29  * Example of use:
30  * \include example-PolarStereographic.cpp
31  **********************************************************************/
33  private:
34  typedef Math::real real;
35  real _a, _f, _e2, _es, _e2m, _c;
36  real _k0;
37  public:
38 
39  /**
40  * Constructor for a ellipsoid with
41  *
42  * @param[in] a equatorial radius (meters).
43  * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
44  * Negative \e f gives a prolate ellipsoid.
45  * @param[in] k0 central scale factor.
46  * @exception GeographicErr if \e a, (1 &minus; \e f) \e a, or \e k0 is
47  * not positive.
48  **********************************************************************/
49  PolarStereographic(real a, real f, real k0);
50 
51  /**
52  * Set the scale for the projection.
53  *
54  * @param[in] lat (degrees) assuming \e northp = true.
55  * @param[in] k scale at latitude \e lat (default 1).
56  * @exception GeographicErr \e k is not positive.
57  * @exception GeographicErr if \e lat is not in (&minus;90&deg;,
58  * 90&deg;].
59  **********************************************************************/
60  void SetScale(real lat, real k = real(1));
61 
62  /**
63  * Forward projection, from geographic to polar stereographic.
64  *
65  * @param[in] northp the pole which is the center of projection (true means
66  * north, false means south).
67  * @param[in] lat latitude of point (degrees).
68  * @param[in] lon longitude of point (degrees).
69  * @param[out] x easting of point (meters).
70  * @param[out] y northing of point (meters).
71  * @param[out] gamma meridian convergence at point (degrees).
72  * @param[out] k scale of projection at point.
73  *
74  * No false easting or northing is added. \e lat should be in the range
75  * (&minus;90&deg;, 90&deg;] for \e northp = true and in the range
76  * [&minus;90&deg;, 90&deg;) for \e northp = false.
77  **********************************************************************/
78  void Forward(bool northp, real lat, real lon,
79  real& x, real& y, real& gamma, real& k) const;
80 
81  /**
82  * Reverse projection, from polar stereographic to geographic.
83  *
84  * @param[in] northp the pole which is the center of projection (true means
85  * north, false means south).
86  * @param[in] x easting of point (meters).
87  * @param[in] y northing of point (meters).
88  * @param[out] lat latitude of point (degrees).
89  * @param[out] lon longitude of point (degrees).
90  * @param[out] gamma meridian convergence at point (degrees).
91  * @param[out] k scale of projection at point.
92  *
93  * No false easting or northing is added. The value of \e lon returned is
94  * in the range [&minus;180&deg;, 180&deg;].
95  **********************************************************************/
96  void Reverse(bool northp, real x, real y,
97  real& lat, real& lon, real& gamma, real& k) const;
98 
99  /**
100  * PolarStereographic::Forward without returning the convergence and scale.
101  **********************************************************************/
102  void Forward(bool northp, real lat, real lon,
103  real& x, real& y) const {
104  real gamma, k;
105  Forward(northp, lat, lon, x, y, gamma, k);
106  }
107 
108  /**
109  * PolarStereographic::Reverse without returning the convergence and scale.
110  **********************************************************************/
111  void Reverse(bool northp, real x, real y,
112  real& lat, real& lon) const {
113  real gamma, k;
114  Reverse(northp, x, y, lat, lon, gamma, k);
115  }
116 
117  /** \name Inspector functions
118  **********************************************************************/
119  ///@{
120  /**
121  * @return \e a the equatorial radius of the ellipsoid (meters). This is
122  * the value used in the constructor.
123  **********************************************************************/
124  Math::real MajorRadius() const { return _a; }
125 
126  /**
127  * @return \e f the flattening of the ellipsoid. This is the value used in
128  * the constructor.
129  **********************************************************************/
130  Math::real Flattening() const { return _f; }
131 
132  /**
133  * The central scale for the projection. This is the value of \e k0 used
134  * in the constructor and is the scale at the pole unless overridden by
135  * PolarStereographic::SetScale.
136  **********************************************************************/
137  Math::real CentralScale() const { return _k0; }
138  ///@}
139 
140  /**
141  * A global instantiation of PolarStereographic with the WGS84 ellipsoid
142  * and the UPS scale factor. However, unlike UPS, no false easting or
143  * northing is added.
144  **********************************************************************/
145  static const PolarStereographic& UPS();
146  };
147 
148 } // namespace GeographicLib
149 
150 #endif // GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:91
GeographicLib::Math::real real
Definition: GeodSolve.cpp:31
void Forward(bool northp, real lat, real lon, real &x, real &y) const
void Reverse(bool northp, real x, real y, real &lat, real &lon) const
Namespace for GeographicLib.
Definition: Accumulator.cpp:12
Polar stereographic projection.
Header for GeographicLib::Constants class.