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