|
||||
File indexing completed on 2025-01-18 09:35:37
0001 // Boost.Geometry (aka GGL, Generic Geometry Library) 0002 // This file is manually converted from PROJ4 0003 0004 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. 0005 0006 // Use, modification and distribution is subject to the Boost Software License, 0007 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 0008 // http://www.boost.org/LICENSE_1_0.txt) 0009 0010 // This file is converted from PROJ4, http://trac.osgeo.org/proj 0011 // PROJ4 is originally written by Gerald Evenden (then of the USGS) 0012 // PROJ4 is maintained by Frank Warmerdam 0013 // PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam) 0014 0015 // Original copyright notice: 0016 0017 // Permission is hereby granted, free of charge, to any person obtaining a 0018 // copy of this software and associated documentation files (the "Software"), 0019 // to deal in the Software without restriction, including without limitation 0020 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 0021 // and/or sell copies of the Software, and to permit persons to whom the 0022 // Software is furnished to do so, subject to the following conditions: 0023 0024 // The above copyright notice and this permission notice shall be included 0025 // in all copies or substantial portions of the Software. 0026 0027 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 0028 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0029 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0030 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0031 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 0032 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 0033 // DEALINGS IN THE SOFTWARE. 0034 0035 #ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_ADJLON_HPP 0036 #define BOOST_GEOMETRY_PROJECTIONS_IMPL_ADJLON_HPP 0037 0038 #include <boost/math/constants/constants.hpp> 0039 #include <boost/geometry/util/math.hpp> 0040 0041 namespace boost { namespace geometry { namespace projections 0042 { 0043 0044 namespace detail 0045 { 0046 0047 /* reduce argument to range +/- PI */ 0048 template <typename T> 0049 inline T adjlon (T lon) 0050 { 0051 if (geometry::math::abs(lon) <= boost::math::constants::pi<T>()) 0052 { 0053 return lon; 0054 } 0055 0056 /* adjust to 0..2pi rad */ 0057 lon += boost::math::constants::pi<T>(); 0058 /* remove integral # of 'revolutions'*/ 0059 lon -= boost::math::constants::two_pi<T>() * 0060 std::floor(lon / boost::math::constants::two_pi<T>()); 0061 /* adjust back to -pi..pi rad */ 0062 lon -= boost::math::constants::pi<T>(); 0063 0064 return lon; 0065 } 0066 0067 } // namespace detail 0068 }}} // namespace boost::geometry::projections 0069 0070 #endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_ADJLON_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |