GeographicLib
1.21
|
00001 /** 00002 * \file AzimuthalEquidistant.hpp 00003 * \brief Header for GeographicLib::AzimuthalEquidistant class 00004 * 00005 * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed 00006 * under the MIT/X11 License. For more information, see 00007 * http://geographiclib.sourceforge.net/ 00008 **********************************************************************/ 00009 00010 #if !defined(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP) 00011 #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP \ 00012 "$Id: 95a1d6e7a8c4613be25ec32550231601202da1e5 $" 00013 00014 #include <GeographicLib/Geodesic.hpp> 00015 #include <GeographicLib/Constants.hpp> 00016 00017 namespace GeographicLib { 00018 00019 /** 00020 * \brief Azimuthal Equidistant Projection. 00021 * 00022 * Azimuthal equidistant projection centered at an arbitrary position on the 00023 * ellipsoid. For a point in projected space (\e x, \e y), the geodesic 00024 * distance from the center position is hypot(\e x, \e y) and the azimuth of 00025 * the geodesic from the center point is atan2(\e x, \e y). The Forward and 00026 * Reverse methods also return the azimuth \e azi of the geodesic at (\e x, 00027 * \e y) and reciprocal scale \e rk in the azimuthal direction which, 00028 * together with the basic properties of the projection, serve to specify 00029 * completely the local affine transformation between geographic and 00030 * projected coordinates. 00031 * 00032 * The conversions all take place using a Geodesic object (by default 00033 * Geodesic::WGS84). For more information on geodesics see \ref geodesic. 00034 * 00035 * Example of use: 00036 * \include example-AzimuthalEquidistant.cpp 00037 * 00038 * <a href="GeodesicProj.1.html">GeodesicProj</a> is a command-line utility 00039 * providing access to the functionality of AzimuthalEquidistant, Gnomonic, 00040 * and CassiniSoldner. 00041 **********************************************************************/ 00042 00043 class GEOGRAPHIC_EXPORT AzimuthalEquidistant { 00044 private: 00045 typedef Math::real real; 00046 Geodesic _earth; 00047 static const real eps_; 00048 public: 00049 00050 /** 00051 * Constructor for AzimuthalEquidistant. 00052 * 00053 * @param[in] earth the Geodesic object to use for geodesic calculations. 00054 * By default this uses the WGS84 ellipsoid. 00055 **********************************************************************/ 00056 explicit AzimuthalEquidistant(const Geodesic& earth = Geodesic::WGS84) 00057 throw() : _earth(earth) {} 00058 00059 /** 00060 * Forward projection, from geographic to azimuthal equidistant. 00061 * 00062 * @param[in] lat0 latitude of center point of projection (degrees). 00063 * @param[in] lon0 longitude of center point of projection (degrees). 00064 * @param[in] lat latitude of point (degrees). 00065 * @param[in] lon longitude of point (degrees). 00066 * @param[out] x easting of point (meters). 00067 * @param[out] y northing of point (meters). 00068 * @param[out] azi azimuth of geodesic at point (degrees). 00069 * @param[out] rk reciprocal of azimuthal scale at point. 00070 * 00071 * \e lat0 and \e lat should be in the range [-90, 90] and \e lon0 and \e 00072 * lon should be in the range [-180, 360]. The scale of the projection is 00073 * 1 in the "radial" direction, \e azi clockwise from true north, and is 00074 * 1/\e rk in the direction perpendicular to this. A call to Forward 00075 * followed by a call to Reverse will return the original (\e lat, \e lon) 00076 * (to within roundoff). 00077 **********************************************************************/ 00078 void Forward(real lat0, real lon0, real lat, real lon, 00079 real& x, real& y, real& azi, real& rk) const throw(); 00080 00081 /** 00082 * Reverse projection, from azimuthal equidistant to geographic. 00083 * 00084 * @param[in] lat0 latitude of center point of projection (degrees). 00085 * @param[in] lon0 longitude of center point of projection (degrees). 00086 * @param[in] x easting of point (meters). 00087 * @param[in] y northing of point (meters). 00088 * @param[out] lat latitude of point (degrees). 00089 * @param[out] lon longitude of point (degrees). 00090 * @param[out] azi azimuth of geodesic at point (degrees). 00091 * @param[out] rk reciprocal of azimuthal scale at point. 00092 * 00093 * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the 00094 * range [-180, 360]. \e lat will be in the range [-90, 90] and \e lon 00095 * will be in the range [-180, 180). The scale of the projection is 1 in 00096 * the "radial" direction, \e azi clockwise from true north, and is 1/\e rk 00097 * in the direction perpendicular to this. A call to Reverse followed by a 00098 * call to Forward will return the original (\e x, \e y) (to roundoff) only 00099 * if the geodesic to (\e x, \e y) is a shortest path. 00100 **********************************************************************/ 00101 void Reverse(real lat0, real lon0, real x, real y, 00102 real& lat, real& lon, real& azi, real& rk) const throw(); 00103 00104 /** 00105 * AzimuthalEquidistant::Forward without returning the azimuth and scale. 00106 **********************************************************************/ 00107 void Forward(real lat0, real lon0, real lat, real lon, 00108 real& x, real& y) const throw() { 00109 real azi, rk; 00110 Forward(lat0, lon0, lat, lon, x, y, azi, rk); 00111 } 00112 00113 /** 00114 * AzimuthalEquidistant::Reverse without returning the azimuth and scale. 00115 **********************************************************************/ 00116 void Reverse(real lat0, real lon0, real x, real y, 00117 real& lat, real& lon) const throw() { 00118 real azi, rk; 00119 Reverse(lat0, lon0, x, y, lat, lon, azi, rk); 00120 } 00121 00122 /** \name Inspector functions 00123 **********************************************************************/ 00124 ///@{ 00125 /** 00126 * @return \e a the equatorial radius of the ellipsoid (meters). This is 00127 * the value inherited from the Geodesic object used in the constructor. 00128 **********************************************************************/ 00129 Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } 00130 00131 /** 00132 * @return \e f the flattening of the ellipsoid. This is the value 00133 * inherited from the Geodesic object used in the constructor. 00134 **********************************************************************/ 00135 Math::real Flattening() const throw() { return _earth.Flattening(); } 00136 ///@} 00137 00138 /// \cond SKIP 00139 /** 00140 * <b>DEPRECATED</b> 00141 * @return \e r the inverse flattening of the ellipsoid. 00142 **********************************************************************/ 00143 Math::real InverseFlattening() const throw() 00144 { return _earth.InverseFlattening(); } 00145 /// \endcond 00146 }; 00147 00148 } // namespace GeographicLib 00149 00150 #endif // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP