diff options
Diffstat (limited to 'boost/geometry/formulas/area_formulas.hpp')
-rw-r--r-- | boost/geometry/formulas/area_formulas.hpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/boost/geometry/formulas/area_formulas.hpp b/boost/geometry/formulas/area_formulas.hpp index 9243c7f749..66d90a7256 100644 --- a/boost/geometry/formulas/area_formulas.hpp +++ b/boost/geometry/formulas/area_formulas.hpp @@ -1,6 +1,6 @@ // Boost.Geometry -// Copyright (c) 2015-2017 Oracle and/or its affiliates. +// Copyright (c) 2015-2018 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -13,6 +13,7 @@ #define BOOST_GEOMETRY_FORMULAS_AREA_FORMULAS_HPP #include <boost/geometry/formulas/flattening.hpp> +#include <boost/geometry/util/math.hpp> #include <boost/math/special_functions/hypot.hpp> namespace boost { namespace geometry { namespace formula @@ -45,7 +46,7 @@ public: Evaluate the polynomial in x using Horner's method. */ template <typename NT, typename IteratorType> - static inline NT horner_evaluate(NT x, + static inline NT horner_evaluate(NT const& x, IteratorType begin, IteratorType end) { @@ -64,7 +65,7 @@ public: https://en.wikipedia.org/wiki/Clenshaw_algorithm */ template <typename NT, typename IteratorType> - static inline NT clenshaw_sum(NT cosx, + static inline NT clenshaw_sum(NT const& cosx, IteratorType begin, IteratorType end) { @@ -166,7 +167,7 @@ public: s/case\sCT(/case /g; s/):/:/g' */ - static inline void evaluate_coeffs_n(CT n, CT coeffs_n[]) + static inline void evaluate_coeffs_n(CT const& n, CT coeffs_n[]) { switch (SeriesOrder) { @@ -245,7 +246,7 @@ public: /* Expand in k2 and ep2. */ - static inline void evaluate_coeffs_ep(CT ep, CT coeffs_n[]) + static inline void evaluate_coeffs_ep(CT const& ep, CT coeffs_n[]) { switch (SeriesOrder) { case 0: @@ -323,18 +324,22 @@ public: Given the set of coefficients coeffs1[] evaluate on var2 and return the set of coefficients coeffs2[] */ - static inline void evaluate_coeffs_var2(CT var2, - CT coeffs1[], - CT coeffs2[]){ + + static inline void evaluate_coeffs_var2(CT const& var2, + CT const coeffs1[], + CT coeffs2[]) + { std::size_t begin(0), end(0); - for(std::size_t i = 0; i <= SeriesOrder; i++){ + for(std::size_t i = 0; i <= SeriesOrder; i++) + { end = begin + SeriesOrder + 1 - i; - coeffs2[i] = ((i==0) ? CT(1) : pow(var2,int(i))) + coeffs2[i] = ((i==0) ? CT(1) : math::pow(var2, int(i))) * horner_evaluate(var2, coeffs1 + begin, coeffs1 + end); begin = end; } } + /* Compute the spherical excess of a geodesic (or shperical) segment */ @@ -403,13 +408,12 @@ public: */ template < template <typename, bool, bool, bool, bool, bool> class Inverse, - //typename AzimuthStrategy, typename PointOfSegment, typename SpheroidConst > static inline return_type_ellipsoidal ellipsoidal(PointOfSegment const& p1, PointOfSegment const& p2, - SpheroidConst spheroid_const) + SpheroidConst const& spheroid_const) { return_type_ellipsoidal result; |