|
||||
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 // This file was modified by Oracle on 2017, 2018. 0007 // Modifications copyright (c) 2017-2018, Oracle and/or its affiliates. 0008 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 0009 0010 // Use, modification and distribution is subject to the Boost Software License, 0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 0012 // http://www.boost.org/LICENSE_1_0.txt) 0013 0014 // This file is converted from PROJ4, http://trac.osgeo.org/proj 0015 // PROJ4 is originally written by Gerald Evenden (then of the USGS) 0016 // PROJ4 is maintained by Frank Warmerdam 0017 // PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam) 0018 0019 // Original copyright notice: 0020 0021 // Permission is hereby granted, free of charge, to any person obtaining a 0022 // copy of this software and associated documentation files (the "Software"), 0023 // to deal in the Software without restriction, including without limitation 0024 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 0025 // and/or sell copies of the Software, and to permit persons to whom the 0026 // Software is furnished to do so, subject to the following conditions: 0027 0028 // The above copyright notice and this permission notice shall be included 0029 // in all copies or substantial portions of the Software. 0030 0031 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 0032 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0033 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0034 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0035 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 0036 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 0037 // DEALINGS IN THE SOFTWARE. 0038 0039 #ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_AUTH_HPP 0040 #define BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_AUTH_HPP 0041 0042 #include <cassert> 0043 #include <cmath> 0044 0045 #include <boost/geometry/core/assert.hpp> 0046 0047 namespace boost { namespace geometry { namespace projections { 0048 0049 namespace detail { 0050 0051 template <typename T> 0052 struct apa 0053 { 0054 static const std::size_t size = 3; 0055 0056 T const& operator[](size_t i) const { return data[i]; } 0057 T & operator[](size_t i) { return data[i]; } 0058 0059 private: 0060 T data[3]; 0061 }; 0062 0063 /* determine latitude from authalic latitude */ 0064 template <typename T> 0065 inline detail::apa<T> pj_authset(T const& es) 0066 { 0067 static const T P00 = .33333333333333333333; 0068 static const T P01 = .17222222222222222222; 0069 static const T P02 = .10257936507936507936; 0070 static const T P10 = .06388888888888888888; 0071 static const T P11 = .06640211640211640211; 0072 static const T P20 = .01641501294219154443; 0073 0074 T t = 0; 0075 detail::apa<T> apa; 0076 0077 { 0078 apa[0] = es * P00; 0079 t = es * es; 0080 apa[0] += t * P01; 0081 apa[1] = t * P10; 0082 t *= es; 0083 apa[0] += t * P02; 0084 apa[1] += t * P11; 0085 apa[2] = t * P20; 0086 } 0087 0088 return apa; 0089 } 0090 0091 template <typename T> 0092 inline T pj_authlat(T const& beta, detail::apa<T> const& apa) 0093 { 0094 T const t = beta + beta; 0095 0096 return(beta + apa[0] * sin(t) + apa[1] * sin(t + t) + apa[2] * sin(t + t + t)); 0097 } 0098 0099 } // namespace detail 0100 }}} // namespace boost::geometry::projections 0101 0102 #endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_AUTH_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |