|
||||
File indexing completed on 2025-01-18 09:35:39
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_ZPOLY1_HPP 0040 #define BOOST_GEOMETRY_PROJECTIONS_ZPOLY1_HPP 0041 0042 0043 #include <boost/geometry/srs/projections/impl/projects.hpp> 0044 0045 0046 namespace boost { namespace geometry { namespace projections { namespace detail { 0047 0048 /* evaluate complex polynomial */ 0049 0050 /* note: coefficients are always from C_1 to C_n 0051 ** i.e. C_0 == (0., 0) 0052 ** n should always be >= 1 though no checks are made 0053 */ 0054 template <typename T> 0055 inline pj_complex<T> 0056 pj_zpoly1(pj_complex<T> z, const pj_complex<T> *C, int n) 0057 { 0058 pj_complex<T> a; 0059 T t; 0060 0061 a = *(C += n); 0062 while (n-- > 0) 0063 { 0064 a.r = (--C)->r + z.r * (t = a.r) - z.i * a.i; 0065 a.i = C->i + z.r * a.i + z.i * t; 0066 } 0067 a.r = z.r * (t = a.r) - z.i * a.i; 0068 a.i = z.r * a.i + z.i * t; 0069 return a; 0070 } 0071 0072 /* evaluate complex polynomial and derivative */ 0073 template <typename T> 0074 inline pj_complex<T> 0075 pj_zpolyd1(pj_complex<T> z, const pj_complex<T> *C, int n, pj_complex<T> *der) 0076 { 0077 T t; 0078 bool first = true; 0079 0080 pj_complex<T> a = *(C += n); 0081 pj_complex<T> b = a; 0082 while (n-- > 0) 0083 { 0084 if (first) 0085 { 0086 first = false; 0087 } 0088 else 0089 { 0090 b.r = a.r + z.r * (t = b.r) - z.i * b.i; 0091 b.i = a.i + z.r * b.i + z.i * t; 0092 } 0093 a.r = (--C)->r + z.r * (t = a.r) - z.i * a.i; 0094 a.i = C->i + z.r * a.i + z.i * t; 0095 } 0096 b.r = a.r + z.r * (t = b.r) - z.i * b.i; 0097 b.i = a.i + z.r * b.i + z.i * t; 0098 a.r = z.r * (t = a.r) - z.i * a.i; 0099 a.i = z.r * a.i + z.i * t; 0100 *der = b; 0101 return a; 0102 } 0103 0104 }}}} // namespace boost::geometry::projections::detail 0105 0106 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |