mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 23:24:02 +00:00
Merge pull request #1036 from awulkiew/fix/various
Fix various errors and warnings
This commit is contained in:
commit
1be04bf84d
@ -3,7 +3,7 @@
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
|
||||
// Copyright (c) 2017-2022 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2017-2021.
|
||||
// Modifications copyright (c) 2017-2021 Oracle and/or its affiliates.
|
||||
@ -69,7 +69,7 @@ namespace detail { namespace area
|
||||
struct box_area
|
||||
{
|
||||
template <typename Box, typename Strategies>
|
||||
static inline typename coordinate_type<Box>::type
|
||||
static inline auto
|
||||
apply(Box const& box, Strategies const& strategies)
|
||||
{
|
||||
// Currently only works for 2D Cartesian boxes
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// R-tree initial packing
|
||||
//
|
||||
// Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland.
|
||||
// Copyright (c) 2011-2022 Adam Wulkiewicz, Lodz, Poland.
|
||||
// Copyright (c) 2020 Caian Benedicto, Campinas, Brazil.
|
||||
//
|
||||
// This file was modified by Oracle on 2019-2021.
|
||||
@ -75,23 +75,28 @@ template <std::size_t I, std::size_t Dimension>
|
||||
struct nth_element_and_half_boxes
|
||||
{
|
||||
template <typename EIt, typename Box>
|
||||
static inline void apply(EIt first, EIt median, EIt last, Box const& box, Box & left, Box & right, std::size_t dim_index)
|
||||
static inline void apply(EIt first, EIt median, EIt last, Box const& box,
|
||||
Box & left, Box & right, std::size_t dim_index)
|
||||
{
|
||||
if ( I == dim_index )
|
||||
if (I == dim_index)
|
||||
{
|
||||
index::detail::nth_element(first, median, last, point_entries_comparer<I>());
|
||||
|
||||
geometry::convert(box, left);
|
||||
geometry::convert(box, right);
|
||||
typename coordinate_type<Box>::type edge_len
|
||||
= geometry::get<max_corner, I>(box) - geometry::get<min_corner, I>(box);
|
||||
typename coordinate_type<Box>::type median
|
||||
= geometry::get<min_corner, I>(box) + edge_len / 2;
|
||||
geometry::set<max_corner, I>(left, median);
|
||||
geometry::set<min_corner, I>(right, median);
|
||||
auto const mi = geometry::get<min_corner, I>(box);
|
||||
auto const ma = geometry::get<max_corner, I>(box);
|
||||
auto const center = mi + (ma - mi) / 2;
|
||||
geometry::set<max_corner, I>(left, center);
|
||||
geometry::set<min_corner, I>(right, center);
|
||||
}
|
||||
else
|
||||
nth_element_and_half_boxes<I+1, Dimension>::apply(first, median, last, box, left, right, dim_index);
|
||||
{
|
||||
nth_element_and_half_boxes
|
||||
<
|
||||
I + 1, Dimension
|
||||
>::apply(first, median, last, box, left, right, dim_index);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 2022 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// Copyright (c) 2022, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
|
||||
@ -41,6 +43,9 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_GENERIC_INVERSE_HPP
|
||||
#define BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_GENERIC_INVERSE_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
@ -57,6 +62,13 @@
|
||||
* Starts with initial guess provided by user in lpInitial
|
||||
*/
|
||||
|
||||
|
||||
namespace boost { namespace geometry { namespace projections
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T, typename Parameters, typename Projection>
|
||||
void pj_generic_inverse_2d(T const& xy_x,
|
||||
T const& xy_y,
|
||||
@ -118,23 +130,23 @@ void pj_generic_inverse_2d(T const& xy_x,
|
||||
{
|
||||
// Limit the amplitude of correction to avoid overshoots due to
|
||||
// bad initial guess
|
||||
T const delta_lam = std::max(
|
||||
std::min(deltaX * deriv_lam_X + deltaY * deriv_lam_Y, 0.3),
|
||||
T const delta_lam = (std::max)(
|
||||
(std::min)(deltaX * deriv_lam_X + deltaY * deriv_lam_Y, 0.3),
|
||||
-0.3);
|
||||
lp_lat -= delta_lam;
|
||||
if (lp_lat < -M_PI)
|
||||
lp_lat = -M_PI;
|
||||
else if (lp_lat > M_PI)
|
||||
lp_lat = M_PI;
|
||||
if (lp_lat < -math::pi<T>())
|
||||
lp_lat = -math::pi<T>();
|
||||
else if (lp_lat > math::pi<T>())
|
||||
lp_lat = math::pi<T>();
|
||||
}
|
||||
|
||||
if (xy_y != 0)
|
||||
{
|
||||
T const delta_phi = std::max(
|
||||
std::min(deltaX * deriv_phi_X + deltaY * deriv_phi_Y, 0.3),
|
||||
T const delta_phi = (std::max)(
|
||||
(std::min)(deltaX * deriv_phi_X + deltaY * deriv_phi_Y, 0.3),
|
||||
-0.3);
|
||||
lp_lon -= delta_phi;
|
||||
static T const half_pi = boost::math::constants::half_pi<T>();
|
||||
static T const half_pi = math::half_pi<T>();
|
||||
if (lp_lon < -half_pi)
|
||||
lp_lon = -half_pi;
|
||||
else if (lp_lon > half_pi)
|
||||
@ -143,3 +155,9 @@ void pj_generic_inverse_2d(T const& xy_x,
|
||||
}
|
||||
//pj_ctx_set_errno(P->ctx, PJD_ERR_NON_CONVERGENT);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
}}} // namespace boost::geometry::projections
|
||||
|
||||
#endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_GENERIC_INVERSE_HPP
|
||||
|
Loading…
x
Reference in New Issue
Block a user