update boost
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2021.
|
||||
// Modifications copyright (c) 2021 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
@@ -16,118 +21,17 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/concept/requires.hpp>
|
||||
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/geometries/concepts/point_concept.hpp>
|
||||
#include <boost/geometry/util/for_each_coordinate.hpp>
|
||||
#include <boost/geometry/util/select_most_precise.hpp>
|
||||
#include <boost/geometry/util/algorithm.hpp>
|
||||
#include <boost/geometry/util/select_coordinate_type.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
template <typename Point>
|
||||
struct param
|
||||
{
|
||||
typedef typename boost::call_traits
|
||||
<
|
||||
typename coordinate_type<Point>::type
|
||||
>::param_type type;
|
||||
};
|
||||
|
||||
|
||||
template <typename Value, template <typename> class Function>
|
||||
struct value_operation
|
||||
{
|
||||
Value m_value;
|
||||
|
||||
inline value_operation(Value const &value)
|
||||
: m_value(value)
|
||||
{}
|
||||
|
||||
template <typename PointDst, std::size_t Index>
|
||||
inline void apply(PointDst& point_dst) const
|
||||
{
|
||||
set<Index>(point_dst,
|
||||
Function
|
||||
<
|
||||
typename geometry::select_most_precise
|
||||
<
|
||||
Value,
|
||||
typename geometry::coordinate_type<PointDst>::type
|
||||
>::type
|
||||
>()(get<Index>(point_dst), m_value));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointSrc, template <typename> class Function>
|
||||
struct point_operation
|
||||
{
|
||||
PointSrc const& m_point_src;
|
||||
|
||||
inline point_operation(PointSrc const& point)
|
||||
: m_point_src(point)
|
||||
{}
|
||||
|
||||
template <typename PointDst, std::size_t Index>
|
||||
inline void apply(PointDst& point_dst) const
|
||||
{
|
||||
set<Index>(point_dst,
|
||||
Function
|
||||
<
|
||||
typename geometry::select_most_precise
|
||||
<
|
||||
typename geometry::coordinate_type<PointSrc>::type,
|
||||
typename geometry::coordinate_type<PointDst>::type
|
||||
>::type
|
||||
>()(get<Index>(point_dst), get<Index>(m_point_src)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Value>
|
||||
struct value_assignment
|
||||
{
|
||||
Value m_value;
|
||||
|
||||
inline value_assignment(Value const &value)
|
||||
: m_value(value)
|
||||
{}
|
||||
|
||||
template <typename PointDst, std::size_t Index>
|
||||
inline void apply(PointDst& point_dst) const
|
||||
{
|
||||
set<Index>(point_dst, m_value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PointSrc>
|
||||
struct point_assignment
|
||||
{
|
||||
PointSrc const& m_point_src;
|
||||
|
||||
inline point_assignment(PointSrc const& point)
|
||||
: m_point_src(point)
|
||||
{}
|
||||
|
||||
template <typename PointDst, std::size_t Index>
|
||||
inline void apply(PointDst& point_dst) const
|
||||
{
|
||||
set<Index>(point_dst, get<Index>(m_point_src));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
/*!
|
||||
\brief Adds the same value to each coordinate of a point
|
||||
\ingroup arithmetic
|
||||
@@ -137,16 +41,14 @@ struct point_assignment
|
||||
\param value value to add
|
||||
*/
|
||||
template <typename Point>
|
||||
inline void add_value(Point& p, typename detail::param<Point>::type value)
|
||||
inline void add_value(Point& p, typename coordinate_type<Point>::type const& value)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
|
||||
|
||||
for_each_coordinate(p,
|
||||
detail::value_operation
|
||||
<
|
||||
typename coordinate_type<Point>::type,
|
||||
std::plus
|
||||
>(value));
|
||||
detail::for_each_dimension<Point>([&](auto index)
|
||||
{
|
||||
set<index>(p, get<index>(p) + value);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -165,7 +67,11 @@ inline void add_point(Point1& p1, Point2 const& p2)
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point1>) );
|
||||
BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<Point2>) );
|
||||
|
||||
for_each_coordinate(p1, detail::point_operation<Point2, std::plus>(p2));
|
||||
detail::for_each_dimension<Point1>([&](auto index)
|
||||
{
|
||||
using calc_t = typename select_coordinate_type<Point1, Point2>::type;
|
||||
set<index>(p1, calc_t(get<index>(p1)) + calc_t(get<index>(p2)));
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -177,16 +83,14 @@ inline void add_point(Point1& p1, Point2 const& p2)
|
||||
\param value value to subtract
|
||||
*/
|
||||
template <typename Point>
|
||||
inline void subtract_value(Point& p, typename detail::param<Point>::type value)
|
||||
inline void subtract_value(Point& p, typename coordinate_type<Point>::type const& value)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
|
||||
|
||||
for_each_coordinate(p,
|
||||
detail::value_operation
|
||||
<
|
||||
typename coordinate_type<Point>::type,
|
||||
std::minus
|
||||
>(value));
|
||||
detail::for_each_dimension<Point>([&](auto index)
|
||||
{
|
||||
set<index>(p, get<index>(p) - value);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -205,7 +109,11 @@ inline void subtract_point(Point1& p1, Point2 const& p2)
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point1>) );
|
||||
BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<Point2>) );
|
||||
|
||||
for_each_coordinate(p1, detail::point_operation<Point2, std::minus>(p2));
|
||||
detail::for_each_dimension<Point1>([&](auto index)
|
||||
{
|
||||
using calc_t = typename select_coordinate_type<Point1, Point2>::type;
|
||||
set<index>(p1, calc_t(get<index>(p1)) - calc_t(get<index>(p2)));
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -217,16 +125,14 @@ inline void subtract_point(Point1& p1, Point2 const& p2)
|
||||
\param value value to multiply by
|
||||
*/
|
||||
template <typename Point>
|
||||
inline void multiply_value(Point& p, typename detail::param<Point>::type value)
|
||||
inline void multiply_value(Point& p, typename coordinate_type<Point>::type const& value)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
|
||||
|
||||
for_each_coordinate(p,
|
||||
detail::value_operation
|
||||
<
|
||||
typename coordinate_type<Point>::type,
|
||||
std::multiplies
|
||||
>(value));
|
||||
detail::for_each_dimension<Point>([&](auto index)
|
||||
{
|
||||
set<index>(p, get<index>(p) * value);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -246,7 +152,11 @@ inline void multiply_point(Point1& p1, Point2 const& p2)
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point1>) );
|
||||
BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<Point2>) );
|
||||
|
||||
for_each_coordinate(p1, detail::point_operation<Point2, std::multiplies>(p2));
|
||||
detail::for_each_dimension<Point1>([&](auto index)
|
||||
{
|
||||
using calc_t = typename select_coordinate_type<Point1, Point2>::type;
|
||||
set<index>(p1, calc_t(get<index>(p1)) * calc_t(get<index>(p2)));
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -258,16 +168,14 @@ inline void multiply_point(Point1& p1, Point2 const& p2)
|
||||
\param value value to divide by
|
||||
*/
|
||||
template <typename Point>
|
||||
inline void divide_value(Point& p, typename detail::param<Point>::type value)
|
||||
inline void divide_value(Point& p, typename coordinate_type<Point>::type const& value)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
|
||||
|
||||
for_each_coordinate(p,
|
||||
detail::value_operation
|
||||
<
|
||||
typename coordinate_type<Point>::type,
|
||||
std::divides
|
||||
>(value));
|
||||
detail::for_each_dimension<Point>([&](auto index)
|
||||
{
|
||||
set<index>(p, get<index>(p) / value);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -286,7 +194,11 @@ inline void divide_point(Point1& p1, Point2 const& p2)
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point1>) );
|
||||
BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<Point2>) );
|
||||
|
||||
for_each_coordinate(p1, detail::point_operation<Point2, std::divides>(p2));
|
||||
detail::for_each_dimension<Point1>([&](auto index)
|
||||
{
|
||||
using calc_t = typename select_coordinate_type<Point1, Point2>::type;
|
||||
set<index>(p1, calc_t(get<index>(p1)) / calc_t(get<index>(p2)));
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -298,15 +210,14 @@ inline void divide_point(Point1& p1, Point2 const& p2)
|
||||
\param value value to assign
|
||||
*/
|
||||
template <typename Point>
|
||||
inline void assign_value(Point& p, typename detail::param<Point>::type value)
|
||||
inline void assign_value(Point& p, typename coordinate_type<Point>::type const& value)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point>) );
|
||||
|
||||
for_each_coordinate(p,
|
||||
detail::value_assignment
|
||||
<
|
||||
typename coordinate_type<Point>::type
|
||||
>(value));
|
||||
detail::for_each_dimension<Point>([&](auto index)
|
||||
{
|
||||
set<index>(p, value);
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -325,7 +236,10 @@ inline void assign_point(Point1& p1, Point2 const& p2)
|
||||
BOOST_CONCEPT_ASSERT( (concepts::Point<Point1>) );
|
||||
BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<Point2>) );
|
||||
|
||||
for_each_coordinate(p1, detail::point_assignment<Point2>(p2));
|
||||
detail::for_each_dimension<Point1>([&](auto index)
|
||||
{
|
||||
set<index>(p1, get<index>(p2));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user