GeographicLib  2.1
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-2022) <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_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;, 90&deg;].
70  * The scale of the projection is 1 in the "radial" direction, \e azi
71  * clockwise from true north, and is 1/\e rk in the direction perpendicular
72  * to this. A call to Forward followed by a call to Reverse will return
73  * the original (\e lat, \e lon) (to within roundoff).
74  **********************************************************************/
75  void Forward(real lat0, real lon0, real lat, real lon,
76  real& x, real& y, real& azi, real& rk) const;
77 
78  /**
79  * Reverse projection, from azimuthal equidistant to geographic.
80  *
81  * @param[in] lat0 latitude of center point of projection (degrees).
82  * @param[in] lon0 longitude of center point of projection (degrees).
83  * @param[in] x easting of point (meters).
84  * @param[in] y northing of point (meters).
85  * @param[out] lat latitude of point (degrees).
86  * @param[out] lon longitude of point (degrees).
87  * @param[out] azi azimuth of geodesic at point (degrees).
88  * @param[out] rk reciprocal of azimuthal scale at point.
89  *
90  * \e lat0 should be in the range [&minus;90&deg;, 90&deg;]. \e lat will
91  * be in the range [&minus;90&deg;, 90&deg;] and \e lon will be in the
92  * range [&minus;180&deg;, 180&deg;]. The scale of the projection is 1 in
93  * the "radial" direction, \e azi clockwise from true north, and is 1/\e rk
94  * in the direction perpendicular to this. A call to Reverse followed by a
95  * call to Forward will return the original (\e x, \e y) (to roundoff) only
96  * if the geodesic to (\e x, \e y) is a shortest path.
97  **********************************************************************/
98  void Reverse(real lat0, real lon0, real x, real y,
99  real& lat, real& lon, real& azi, real& rk) const;
100 
101  /**
102  * AzimuthalEquidistant::Forward without returning the azimuth and scale.
103  **********************************************************************/
104  void Forward(real lat0, real lon0, real lat, real lon,
105  real& x, real& y) const {
106  real azi, rk;
107  Forward(lat0, lon0, lat, lon, x, y, azi, rk);
108  }
109 
110  /**
111  * AzimuthalEquidistant::Reverse without returning the azimuth and scale.
112  **********************************************************************/
113  void Reverse(real lat0, real lon0, real x, real y,
114  real& lat, real& lon) const {
115  real azi, rk;
116  Reverse(lat0, lon0, x, y, lat, lon, azi, rk);
117  }
118 
119  /** \name Inspector functions
120  **********************************************************************/
121  ///@{
122  /**
123  * @return \e a the equatorial radius of the ellipsoid (meters). This is
124  * the value inherited from the Geodesic object used in the constructor.
125  **********************************************************************/
126  Math::real EquatorialRadius() const { return _earth.EquatorialRadius(); }
127 
128  /**
129  * @return \e f the flattening of the ellipsoid. This is the value
130  * inherited from the Geodesic object used in the constructor.
131  **********************************************************************/
132  Math::real Flattening() const { return _earth.Flattening(); }
133  ///@}
134 
135  };
136 
137 } // namespace GeographicLib
138 
139 #endif // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP
Header for GeographicLib::Constants class.
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:67
GeographicLib::Math::real real
Definition: GeodSolve.cpp:31
Header for GeographicLib::Geodesic class.
Azimuthal equidistant projection.
void Forward(real lat0, real lon0, real lat, real lon, real &x, real &y) const
void Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon) const
Geodesic calculations
Definition: Geodesic.hpp:172
Math::real Flattening() const
Definition: Geodesic.hpp:955
static const Geodesic & WGS84()
Definition: Geodesic.cpp:89
Math::real EquatorialRadius() const
Definition: Geodesic.hpp:949
Namespace for GeographicLib.
Definition: Accumulator.cpp:12