GeographicLib  1.37
AzimuthalEquidistant.hpp
Go to the documentation of this file.
1 /**
2  * \file AzimuthalEquidistant.hpp
3  * \brief Header for GeographicLib::AzimuthalEquidistant class
4  *
5  * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed
6  * under the MIT/X11 License. For more information, see
7  * http://geographiclib.sourceforge.net/
8  **********************************************************************/
9 
10 #if !defined(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP)
11 #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP 1
12 
15 
16 namespace GeographicLib {
17 
18  /**
19  * \brief Azimuthal equidistant projection
20  *
21  * Azimuthal equidistant projection centered at an arbitrary position on the
22  * ellipsoid. For a point in projected space (\e x, \e y), the geodesic
23  * distance from the center position is hypot(\e x, \e y) and the azimuth of
24  * the geodesic from the center point is atan2(\e x, \e y). The Forward and
25  * Reverse methods also return the azimuth \e azi of the geodesic at (\e x,
26  * \e y) and reciprocal scale \e rk in the azimuthal direction which,
27  * together with the basic properties of the projection, serve to specify
28  * completely the local affine transformation between geographic and
29  * projected coordinates.
30  *
31  * The conversions all take place using a Geodesic object (by default
32  * Geodesic::WGS84()). For more information on geodesics see \ref geodesic.
33  *
34  * Example of use:
35  * \include example-AzimuthalEquidistant.cpp
36  *
37  * <a href="GeodesicProj.1.html">GeodesicProj</a> is a command-line utility
38  * providing access to the functionality of AzimuthalEquidistant, Gnomonic,
39  * and CassiniSoldner.
40  **********************************************************************/
41 
43  private:
44  typedef Math::real real;
45  real eps_;
46  Geodesic _earth;
47  public:
48 
49  /**
50  * Constructor for AzimuthalEquidistant.
51  *
52  * @param[in] earth the Geodesic object to use for geodesic calculations.
53  * By default this uses the WGS84 ellipsoid.
54  **********************************************************************/
55  explicit AzimuthalEquidistant(const Geodesic& earth = Geodesic::WGS84());
56 
57  /**
58  * Forward projection, from geographic to azimuthal equidistant.
59  *
60  * @param[in] lat0 latitude of center point of projection (degrees).
61  * @param[in] lon0 longitude of center point of projection (degrees).
62  * @param[in] lat latitude of point (degrees).
63  * @param[in] lon longitude of point (degrees).
64  * @param[out] x easting of point (meters).
65  * @param[out] y northing of point (meters).
66  * @param[out] azi azimuth of geodesic at point (degrees).
67  * @param[out] rk reciprocal of azimuthal scale at point.
68  *
69  * \e lat0 and \e lat should be in the range [&minus;90&deg;,
70  * 90&deg;] and \e lon0 and \e lon should be in the range
71  * [&minus;540&deg;, 540&deg;). The scale of the projection is 1
72  * in the "radial" direction, \e azi clockwise from true north, and is 1/\e
73  * rk in the direction perpendicular to this. A call to Forward followed
74  * by a call to Reverse will return the original (\e lat, \e lon) (to
75  * within roundoff).
76  **********************************************************************/
77  void Forward(real lat0, real lon0, real lat, real lon,
78  real& x, real& y, real& azi, real& rk) const;
79 
80  /**
81  * Reverse projection, from azimuthal equidistant to geographic.
82  *
83  * @param[in] lat0 latitude of center point of projection (degrees).
84  * @param[in] lon0 longitude of center point of projection (degrees).
85  * @param[in] x easting of point (meters).
86  * @param[in] y northing of point (meters).
87  * @param[out] lat latitude of point (degrees).
88  * @param[out] lon longitude of point (degrees).
89  * @param[out] azi azimuth of geodesic at point (degrees).
90  * @param[out] rk reciprocal of azimuthal scale at point.
91  *
92  * \e lat0 should be in the range [&minus;90&deg;, 90&deg;] and \e
93  * lon0 should be in the range [&minus;540&deg;, 540&deg;). \e lat
94  * will be in the range [&minus;90&deg;, 90&deg;] and \e lon will
95  * be in the range [&minus;180&deg;, 180&deg;). The scale of the
96  * projection is 1 in the "radial" direction, \e azi clockwise from true
97  * north, and is 1/\e rk in the direction perpendicular to this. A call to
98  * Reverse followed by a call to Forward will return the original (\e x, \e
99  * y) (to roundoff) only if the geodesic to (\e x, \e y) is a shortest
100  * path.
101  **********************************************************************/
102  void Reverse(real lat0, real lon0, real x, real y,
103  real& lat, real& lon, real& azi, real& rk) const;
104 
105  /**
106  * AzimuthalEquidistant::Forward without returning the azimuth and scale.
107  **********************************************************************/
108  void Forward(real lat0, real lon0, real lat, real lon,
109  real& x, real& y) const {
110  real azi, rk;
111  Forward(lat0, lon0, lat, lon, x, y, azi, rk);
112  }
113 
114  /**
115  * AzimuthalEquidistant::Reverse without returning the azimuth and scale.
116  **********************************************************************/
117  void Reverse(real lat0, real lon0, real x, real y,
118  real& lat, real& lon) const {
119  real azi, rk;
120  Reverse(lat0, lon0, x, y, lat, lon, azi, rk);
121  }
122 
123  /** \name Inspector functions
124  **********************************************************************/
125  ///@{
126  /**
127  * @return \e a the equatorial radius of the ellipsoid (meters). This is
128  * the value inherited from the Geodesic object used in the constructor.
129  **********************************************************************/
130  Math::real MajorRadius() const { return _earth.MajorRadius(); }
131 
132  /**
133  * @return \e f the flattening of the ellipsoid. This is the value
134  * inherited from the Geodesic object used in the constructor.
135  **********************************************************************/
136  Math::real Flattening() const { return _earth.Flattening(); }
137  ///@}
138 
139  /// \cond SKIP
140  /**
141  * <b>DEPRECATED</b>
142  * @return \e r the inverse flattening of the ellipsoid.
143  **********************************************************************/
144  Math::real InverseFlattening() const
145  { return _earth.InverseFlattening(); }
146  /// \endcond
147  };
148 
149 } // namespace GeographicLib
150 
151 #endif // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:70
GeographicLib::Math::real real
Definition: GeodSolve.cpp:40
static const Geodesic & WGS84()
Definition: Geodesic.cpp:90
Math::real MajorRadius() const
Definition: Geodesic.hpp:855
Header for GeographicLib::Geodesic class.
Azimuthal equidistant projection.
Namespace for GeographicLib.
Definition: Accumulator.cpp:12
void Forward(real lat0, real lon0, real lat, real lon, real &x, real &y) const
Header for GeographicLib::Constants class.
void Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon) const
Math::real Flattening() const
Definition: Geodesic.hpp:861
Geodesic calculations
Definition: Geodesic.hpp:172