GeographicLib  1.35
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  Geodesic _earth;
46  static const real eps_;
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  **********************************************************************/
56  throw() : _earth(earth) {}
57 
58  /**
59  * Forward projection, from geographic to azimuthal equidistant.
60  *
61  * @param[in] lat0 latitude of center point of projection (degrees).
62  * @param[in] lon0 longitude of center point of projection (degrees).
63  * @param[in] lat latitude of point (degrees).
64  * @param[in] lon longitude of point (degrees).
65  * @param[out] x easting of point (meters).
66  * @param[out] y northing of point (meters).
67  * @param[out] azi azimuth of geodesic at point (degrees).
68  * @param[out] rk reciprocal of azimuthal scale at point.
69  *
70  * \e lat0 and \e lat should be in the range [&minus;90&deg;,
71  * 90&deg;] and \e lon0 and \e lon should be in the range
72  * [&minus;540&deg;, 540&deg;). The scale of the projection is 1
73  * in the "radial" direction, \e azi clockwise from true north, and is 1/\e
74  * rk in the direction perpendicular to this. A call to Forward followed
75  * by a call to Reverse will return the original (\e lat, \e lon) (to
76  * within roundoff).
77  **********************************************************************/
78  void Forward(real lat0, real lon0, real lat, real lon,
79  real& x, real& y, real& azi, real& rk) const throw();
80 
81  /**
82  * Reverse projection, from azimuthal equidistant to geographic.
83  *
84  * @param[in] lat0 latitude of center point of projection (degrees).
85  * @param[in] lon0 longitude of center point of projection (degrees).
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] azi azimuth of geodesic at point (degrees).
91  * @param[out] rk reciprocal of azimuthal scale at point.
92  *
93  * \e lat0 should be in the range [&minus;90&deg;, 90&deg;] and \e
94  * lon0 should be in the range [&minus;540&deg;, 540&deg;). \e lat
95  * will be in the range [&minus;90&deg;, 90&deg;] and \e lon will
96  * be in the range [&minus;180&deg;, 180&deg;). The scale of the
97  * projection is 1 in the "radial" direction, \e azi clockwise from true
98  * north, and is 1/\e rk in the direction perpendicular to this. A call to
99  * Reverse followed by a call to Forward will return the original (\e x, \e
100  * y) (to roundoff) only if the geodesic to (\e x, \e y) is a shortest
101  * path.
102  **********************************************************************/
103  void Reverse(real lat0, real lon0, real x, real y,
104  real& lat, real& lon, real& azi, real& rk) const throw();
105 
106  /**
107  * AzimuthalEquidistant::Forward without returning the azimuth and scale.
108  **********************************************************************/
109  void Forward(real lat0, real lon0, real lat, real lon,
110  real& x, real& y) const throw() {
111  real azi, rk;
112  Forward(lat0, lon0, lat, lon, x, y, azi, rk);
113  }
114 
115  /**
116  * AzimuthalEquidistant::Reverse without returning the azimuth and scale.
117  **********************************************************************/
118  void Reverse(real lat0, real lon0, real x, real y,
119  real& lat, real& lon) const throw() {
120  real azi, rk;
121  Reverse(lat0, lon0, x, y, lat, lon, azi, rk);
122  }
123 
124  /** \name Inspector functions
125  **********************************************************************/
126  ///@{
127  /**
128  * @return \e a the equatorial radius of the ellipsoid (meters). This is
129  * the value inherited from the Geodesic object used in the constructor.
130  **********************************************************************/
131  Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
132 
133  /**
134  * @return \e f the flattening of the ellipsoid. This is the value
135  * inherited from the Geodesic object used in the constructor.
136  **********************************************************************/
137  Math::real Flattening() const throw() { return _earth.Flattening(); }
138  ///@}
139 
140  /// \cond SKIP
141  /**
142  * <b>DEPRECATED</b>
143  * @return \e r the inverse flattening of the ellipsoid.
144  **********************************************************************/
145  Math::real InverseFlattening() const throw()
146  { return _earth.InverseFlattening(); }
147  /// \endcond
148  };
149 
150 } // namespace GeographicLib
151 
152 #endif // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:52
GeographicLib::Math::real real
Definition: GeodSolve.cpp:40
Header for GeographicLib::Geodesic class.
Azimuthal equidistant projection.
void Forward(real lat0, real lon0, real lat, real lon, real &x, real &y) const
static const Geodesic WGS84
Definition: Geodesic.hpp:889
Header for GeographicLib::Constants class.
void Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon) const
Geodesic calculations
Definition: Geodesic.hpp:169
AzimuthalEquidistant(const Geodesic &earth=Geodesic::WGS84)