AzimuthalEquidistant.hpp

Go to the documentation of this file.
00001 /**
00002  * \file AzimuthalEquidistant.hpp
00003  * \brief Header for GeographicLib::AzimuthalEquidistant class
00004  *
00005  * Copyright (c) Charles Karney (2009, 2010) <charles@karney.com>
00006  * and licensed under the LGPL.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP)
00011 #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP "$Id: AzimuthalEquidistant.hpp 6778 2010-01-02 21:29:34Z karney $"
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 GeographicLib::Geodesic object (by
00032    * default GeographicLib::Geodesic::WGS84).  For more information on
00033    * geodesics see \ref geodesic.
00034    **********************************************************************/
00035 
00036   class AzimuthalEquidistant {
00037   private:
00038     typedef Math::real real;
00039     const Geodesic _earth;
00040     static const real eps;
00041   public:
00042 
00043     /**
00044      * Constructor for AzimuthalEquidistant setting the Geodesic object to use
00045      * for geodesic calculations.  By default this uses the WGS84 ellipsoid.
00046      **********************************************************************/
00047     explicit AzimuthalEquidistant(const Geodesic& earth = Geodesic::WGS84)
00048       throw() : _earth(earth) {}
00049 
00050     /**
00051      * Convert from latitude \e lat (degrees) and longitude \e lon (degrees) to
00052      * azimuthal equidistant easting \e x (meters) and northing \e y (meters).
00053      * The center of the projection is at latitude \e lat0 (degrees) and
00054      * longitude \e lon0 (degrees).  Also return the azimuth \e azi (degrees)
00055      * and the reciprocal of the azimuthal scale \e rk.  \e lat0 and \e lat
00056      * should be in the range [-90, 90] and \e lon0 and \e lon should be in the
00057      * range [-180, 360].  The scale of the projection is 1 in the "radial"
00058      * direction, \e azi clockwise from true north, and is 1/\e rk in the
00059      * direction perpendicular to this.  A call to Forward followed by a call
00060      * to Reverse will return the original (\e lat, \e lon) (to within
00061      * roundoff).
00062      **********************************************************************/
00063     void Forward(real lat0, real lon0, real lat, real lon,
00064                  real& x, real& y, real& azi, real& rk) const throw();
00065 
00066     /**
00067      * Convert from azimuthal equidistant easting \e x (meters) and northing \e
00068      * y (meters) to latitude \e lat (degrees) and longitude \e lon (degrees).
00069      * The center of the projection is at latitude \e lat0 (degrees) and
00070      * longitude \e lon0 (degrees).  Also return the azimuth \e azi (degrees)
00071      * and the reciprocal of the azimuthal scale \e rk.  \e lat0 should be in
00072      * the range [-90, 90] and \e lon0 should be in the range [-180, 360].  \e
00073      * lat will be in the range [-90, 90] and \e lon will be in the range
00074      * [-180, 180).  The scale of the projection is 1 in the "radial"
00075      * direction, \e azi clockwise from true north, and is 1/\e rk in the
00076      * direction perpendicular to this.  A call to Reverse followed by a call
00077      * to Forward will return the original (\e x, \e y) (to roundoff) only if
00078      * the geodesic to (\e x, \e y) is a shortest path.
00079      **********************************************************************/
00080     void Reverse(real lat0, real lon0, real x, real y,
00081                  real& lat, real& lon, real& azi, real& rk) const throw();
00082 
00083     /**
00084      * The major radius of the ellipsoid (meters).  This is that value of \e a
00085      * inherited from the Geodesic object used in the constructor.
00086      **********************************************************************/
00087     Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
00088 
00089     /**
00090      * The inverse flattening of the ellipsoid.  This is that value of \e r
00091      * inherited from the Geodesic object used in the constructor.  A value of
00092      * 0 is returned for a sphere (infinite inverse flattening).
00093      **********************************************************************/
00094     Math::real InverseFlattening() const throw()
00095     { return _earth.InverseFlattening(); }
00096   };
00097 
00098 } // namespace GeographicLib
00099 
00100 #endif

Generated on 21 May 2010 for GeographicLib by  doxygen 1.6.1