update boost
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2017.
|
||||
// Modifications copyright (c) 2017, Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2017-2023.
|
||||
// Modifications copyright (c) 2017-2023, 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
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
@@ -18,6 +19,7 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/geometry/strategies/compare.hpp>
|
||||
#include <boost/geometry/strategies/spherical/compare.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
|
||||
|
||||
@@ -36,47 +38,243 @@ namespace boost { namespace geometry
|
||||
on equal x-es then on y, etc.
|
||||
If a dimension is specified, only that dimension is considered
|
||||
*/
|
||||
|
||||
template
|
||||
<
|
||||
typename Point = void,
|
||||
int Dimension = -1
|
||||
int Dimension = -1,
|
||||
typename StrategyOrTag = void
|
||||
>
|
||||
struct less
|
||||
struct less_exact
|
||||
{
|
||||
typedef Point first_argument_type;
|
||||
typedef Point second_argument_type;
|
||||
typedef bool result_type;
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
inline bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
typedef typename strategy::compare::services::default_strategy
|
||||
return StrategyOrTag::template compare_type
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_exact
|
||||
>::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template
|
||||
<
|
||||
typename Point = void,
|
||||
int Dimension = -1,
|
||||
typename StrategyOrTag = void
|
||||
>
|
||||
struct less
|
||||
{
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
inline bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
return StrategyOrTag::template compare_type
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon
|
||||
>::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Point, int Dimension>
|
||||
struct less<Point, Dimension, void>
|
||||
{
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
inline bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point, Point,
|
||||
Dimension
|
||||
>::type strategy_type;
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension, typename Strategy>
|
||||
struct less<void, Dimension, Strategy>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
inline bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
return Strategy::template compare_type
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon
|
||||
>::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
// for backward compatibility
|
||||
|
||||
template <typename Point, int Dimension>
|
||||
struct less<Point, Dimension, boost::geometry::cartesian_tag>
|
||||
{
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
inline bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point, Point,
|
||||
Dimension,
|
||||
boost::geometry::cartesian_tag, boost::geometry::cartesian_tag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Point, int Dimension>
|
||||
struct less<Point, Dimension, boost::geometry::spherical_tag>
|
||||
{
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
inline bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point, Point,
|
||||
Dimension,
|
||||
boost::geometry::spherical_tag, boost::geometry::spherical_tag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Point, int Dimension>
|
||||
struct less<Point, Dimension, boost::geometry::geographic_tag>
|
||||
{
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
inline bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point, Point,
|
||||
Dimension,
|
||||
boost::geometry::geographic_tag, boost::geometry::geographic_tag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension>
|
||||
struct less<void, Dimension>
|
||||
struct less<void, Dimension, boost::geometry::cartesian_tag>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
inline bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
typedef typename strategy::compare::services::default_strategy
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point1, Point2,
|
||||
Dimension
|
||||
>::type strategy_type;
|
||||
Dimension,
|
||||
boost::geometry::cartesian_tag, boost::geometry::cartesian_tag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension>
|
||||
struct less<void, Dimension, boost::geometry::spherical_tag>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
inline bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point1, Point2,
|
||||
Dimension,
|
||||
boost::geometry::spherical_tag, boost::geometry::spherical_tag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension>
|
||||
struct less<void, Dimension, boost::geometry::geographic_tag>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
inline bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point1, Point2,
|
||||
Dimension,
|
||||
boost::geometry::geographic_tag, boost::geometry::geographic_tag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <int Dimension>
|
||||
struct less<void, Dimension, void>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
inline bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::less,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point1, Point2,
|
||||
Dimension
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\brief Greater functor
|
||||
@@ -87,39 +285,87 @@ struct less<void, Dimension>
|
||||
template
|
||||
<
|
||||
typename Point = void,
|
||||
int Dimension = -1
|
||||
int Dimension = -1,
|
||||
typename CSTag = void
|
||||
>
|
||||
struct greater
|
||||
{
|
||||
typedef Point first_argument_type;
|
||||
typedef Point second_argument_type;
|
||||
typedef bool result_type;
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
typedef typename strategy::compare::services::default_strategy
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::greater,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point, Point,
|
||||
Dimension,
|
||||
CSTag, CSTag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension, typename CSTag>
|
||||
struct greater<void, Dimension, CSTag>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::greater,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point1, Point2,
|
||||
Dimension,
|
||||
CSTag, CSTag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Point, int Dimension>
|
||||
struct greater<Point, Dimension, void>
|
||||
{
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::greater,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point, Point,
|
||||
Dimension
|
||||
>::type strategy_type;
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension>
|
||||
struct greater<void, Dimension>
|
||||
struct greater<void, Dimension, void>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
typedef typename strategy::compare::services::default_strategy
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::greater,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point1, Point2,
|
||||
Dimension
|
||||
>::type strategy_type;
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
@@ -137,39 +383,87 @@ struct greater<void, Dimension>
|
||||
template
|
||||
<
|
||||
typename Point,
|
||||
int Dimension = -1
|
||||
int Dimension = -1,
|
||||
typename CSTag = void
|
||||
>
|
||||
struct equal_to
|
||||
{
|
||||
typedef Point first_argument_type;
|
||||
typedef Point second_argument_type;
|
||||
typedef bool result_type;
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
typedef typename strategy::compare::services::default_strategy
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::equal_to,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point, Point,
|
||||
Dimension,
|
||||
CSTag, CSTag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension, typename CSTag>
|
||||
struct equal_to<void, Dimension, CSTag>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::equal_to,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point1, Point2,
|
||||
Dimension,
|
||||
CSTag, CSTag
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Point, int Dimension>
|
||||
struct equal_to<Point, Dimension, void>
|
||||
{
|
||||
using first_argument_type = Point;
|
||||
using second_argument_type = Point;
|
||||
using result_type = bool;
|
||||
|
||||
bool operator()(Point const& left, Point const& right) const
|
||||
{
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::equal_to,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point, Point,
|
||||
Dimension
|
||||
>::type strategy_type;
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Dimension>
|
||||
struct equal_to<void, Dimension>
|
||||
struct equal_to<void, Dimension, void>
|
||||
{
|
||||
using result_type = bool;
|
||||
|
||||
template <typename Point1, typename Point2>
|
||||
bool operator()(Point1 const& left, Point2 const& right) const
|
||||
{
|
||||
typedef typename strategy::compare::services::default_strategy
|
||||
using strategy_type = typename strategy::compare::services::default_strategy
|
||||
<
|
||||
strategy::compare::equal_to,
|
||||
strategy::compare::equals_epsilon,
|
||||
Point1, Point2,
|
||||
Dimension
|
||||
>::type strategy_type;
|
||||
>::type;
|
||||
|
||||
return strategy_type::apply(left, right);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2013-2014.
|
||||
// Modifications copyright (c) 2013-2014, Oracle and/or its affiliates.
|
||||
|
||||
// This file was modified by Oracle on 2013-2020.
|
||||
// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
@@ -21,7 +20,7 @@
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_POLICIES_DISJOINT_INTERRUPT_POLICY_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_POLICIES_DISJOINT_INTERRUPT_POLICY_HPP
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/range/size.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
@@ -14,7 +15,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/geometry/io/dsv/write.hpp>
|
||||
#include <boost/geometry/util/condition.hpp>
|
||||
#include <boost/geometry/util/constexpr.hpp>
|
||||
#include <boost/geometry/util/range.hpp>
|
||||
#include <boost/geometry/algorithms/validity_failure_type.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
@@ -69,10 +70,12 @@ private:
|
||||
static inline
|
||||
validity_failure_type transform_failure_type(validity_failure_type failure)
|
||||
{
|
||||
if (BOOST_GEOMETRY_CONDITION(
|
||||
AllowDuplicates && failure == failure_duplicate_points))
|
||||
if BOOST_GEOMETRY_CONSTEXPR (AllowDuplicates)
|
||||
{
|
||||
return no_failure;
|
||||
if (failure == failure_duplicate_points)
|
||||
{
|
||||
return no_failure;
|
||||
}
|
||||
}
|
||||
return failure;
|
||||
}
|
||||
@@ -81,10 +84,12 @@ private:
|
||||
validity_failure_type transform_failure_type(validity_failure_type failure,
|
||||
bool is_linear)
|
||||
{
|
||||
if (BOOST_GEOMETRY_CONDITION(
|
||||
is_linear && AllowSpikes && failure == failure_spikes))
|
||||
if BOOST_GEOMETRY_CONSTEXPR (AllowSpikes)
|
||||
{
|
||||
return no_failure;
|
||||
if (is_linear && failure == failure_spikes)
|
||||
{
|
||||
return no_failure;
|
||||
}
|
||||
}
|
||||
return transform_failure_type(failure);
|
||||
}
|
||||
@@ -123,9 +128,12 @@ private:
|
||||
bool is_linear,
|
||||
SpikePoint const& spike_point)
|
||||
{
|
||||
if (BOOST_GEOMETRY_CONDITION(is_linear && AllowSpikes))
|
||||
if BOOST_GEOMETRY_CONSTEXPR (AllowSpikes)
|
||||
{
|
||||
return;
|
||||
if (is_linear)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
oss << ". A spike point was found with apex at "
|
||||
@@ -173,7 +181,7 @@ private:
|
||||
static inline void apply(std::ostringstream& oss,
|
||||
Point const& point)
|
||||
{
|
||||
if (BOOST_GEOMETRY_CONDITION(AllowDuplicates))
|
||||
if BOOST_GEOMETRY_CONSTEXPR (AllowDuplicates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2014, Oracle and/or its affiliates.
|
||||
// Copyright (c) 2014-2023, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
@@ -10,9 +12,11 @@
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_POLICIES_PREDICATE_BASED_INTERRUPT_POLICY_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_POLICIES_PREDICATE_BASED_INTERRUPT_POLICY_HPP
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/check_iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/empty.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@@ -42,12 +46,14 @@ struct stateless_predicate_based_interrupt_policy
|
||||
template <typename Range>
|
||||
inline bool apply(Range const& range)
|
||||
{
|
||||
// if there is at least one unacceptable turn in the range, return false
|
||||
has_intersections = !detail::check_iterator_range
|
||||
<
|
||||
IsAcceptableTurnPredicate,
|
||||
AllowEmptyTurnRange
|
||||
>::apply(boost::begin(range), boost::end(range));
|
||||
// if there is at least one unacceptable turn in the range, return true
|
||||
bool const has_unacceptable_turn = std::any_of(boost::begin(range), boost::end(range),
|
||||
[](auto const& turn) {
|
||||
return ! IsAcceptableTurnPredicate::apply(turn);
|
||||
});
|
||||
|
||||
has_intersections = has_unacceptable_turn
|
||||
&& !(AllowEmptyTurnRange && boost::empty(range));
|
||||
|
||||
return has_intersections;
|
||||
}
|
||||
@@ -77,12 +83,15 @@ struct predicate_based_interrupt_policy
|
||||
template <typename Range>
|
||||
inline bool apply(Range const& range)
|
||||
{
|
||||
// if there is at least one unacceptable turn in the range, return false
|
||||
has_intersections = !detail::check_iterator_range
|
||||
<
|
||||
IsAcceptableTurnPredicate,
|
||||
AllowEmptyTurnRange
|
||||
>::apply(boost::begin(range), boost::end(range), m_predicate);
|
||||
// if there is at least one unacceptable turn in the range, return true
|
||||
bool const has_unacceptable_turn = std::any_of(boost::begin(range),
|
||||
boost::end(range),
|
||||
[&]( auto const& turn ) {
|
||||
return ! m_predicate.apply(turn);
|
||||
});
|
||||
|
||||
has_intersections = has_unacceptable_turn
|
||||
&& !(AllowEmptyTurnRange && boost::empty(range));
|
||||
|
||||
return has_intersections;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016 Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2016, 2022.
|
||||
// Modifications copyright (c) 2016-2022 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
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
@@ -68,7 +69,7 @@ struct segments_intersection_points
|
||||
Ratio const& rb_from_wrt_a, Ratio const& rb_to_wrt_a)
|
||||
{
|
||||
return_type result;
|
||||
unsigned int index = 0, count_a = 0, count_b = 0;
|
||||
unsigned int index = 0;
|
||||
Ratio on_a[2];
|
||||
|
||||
// The conditions "index < 2" are necessary for non-robust handling,
|
||||
@@ -87,7 +88,6 @@ struct segments_intersection_points
|
||||
result.fractions[index].assign(Ratio::zero(), ra_from_wrt_b);
|
||||
on_a[index] = Ratio::zero();
|
||||
index++;
|
||||
count_a++;
|
||||
}
|
||||
if (b1_wrt_a == 2 //rb_from_wrt_a.in_segment()
|
||||
&& index < 2)
|
||||
@@ -103,7 +103,6 @@ struct segments_intersection_points
|
||||
result.fractions[index].assign(rb_from_wrt_a, Ratio::zero());
|
||||
on_a[index] = rb_from_wrt_a;
|
||||
index++;
|
||||
count_b++;
|
||||
}
|
||||
|
||||
if (a2_wrt_b >= 1 && a2_wrt_b <= 3 //ra_to_wrt_b.on_segment()
|
||||
@@ -116,7 +115,6 @@ struct segments_intersection_points
|
||||
result.fractions[index].assign(Ratio::one(), ra_to_wrt_b);
|
||||
on_a[index] = Ratio::one();
|
||||
index++;
|
||||
count_a++;
|
||||
}
|
||||
if (b2_wrt_a == 2 // rb_to_wrt_a.in_segment()
|
||||
&& index < 2)
|
||||
@@ -125,7 +123,6 @@ struct segments_intersection_points
|
||||
result.fractions[index].assign(rb_to_wrt_a, Ratio::one());
|
||||
on_a[index] = rb_to_wrt_a;
|
||||
index++;
|
||||
count_b++;
|
||||
}
|
||||
|
||||
// TEMPORARY
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2007-2020 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2020.
|
||||
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP
|
||||
#define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include <boost/geometry/policies/relate/direction.hpp>
|
||||
#include <boost/geometry/policies/relate/intersection_points.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/side_info.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace policies { namespace relate
|
||||
{
|
||||
|
||||
|
||||
template <typename IntersectionPointsReturnType>
|
||||
struct segments_intersection_policy
|
||||
{
|
||||
private:
|
||||
typedef policies::relate::segments_intersection_points
|
||||
<
|
||||
IntersectionPointsReturnType
|
||||
> pts_policy;
|
||||
typedef policies::relate::segments_direction dir_policy;
|
||||
|
||||
public:
|
||||
struct return_type
|
||||
{
|
||||
typedef typename pts_policy::return_type intersection_points_type;
|
||||
typedef typename dir_policy::return_type direction_type;
|
||||
|
||||
return_type(intersection_points_type const& pts_result,
|
||||
direction_type const& dir_result)
|
||||
: intersection_points(pts_result)
|
||||
, direction(dir_result)
|
||||
{}
|
||||
|
||||
intersection_points_type intersection_points;
|
||||
direction_type direction;
|
||||
};
|
||||
|
||||
template <typename Segment1, typename Segment2, typename SegmentIntersectionInfo>
|
||||
static inline return_type segments_crosses(side_info const& sides,
|
||||
SegmentIntersectionInfo const& sinfo,
|
||||
Segment1 const& s1, Segment2 const& s2)
|
||||
{
|
||||
return return_type
|
||||
(
|
||||
pts_policy::segments_crosses(sides, sinfo, s1, s2),
|
||||
dir_policy::segments_crosses(sides, sinfo, s1, s2)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Segment1, typename Segment2, typename Ratio>
|
||||
static inline return_type segments_collinear(
|
||||
Segment1 const& segment1,
|
||||
Segment2 const& segment2,
|
||||
bool opposite,
|
||||
int pa1, int pa2, int pb1, int pb2,
|
||||
Ratio const& ra1, Ratio const& ra2,
|
||||
Ratio const& rb1, Ratio const& rb2)
|
||||
{
|
||||
return return_type
|
||||
(
|
||||
pts_policy::segments_collinear(segment1, segment2,
|
||||
opposite,
|
||||
pa1, pa2, pb1, pb2,
|
||||
ra1, ra2, rb1, rb2),
|
||||
dir_policy::segments_collinear(segment1, segment2,
|
||||
opposite,
|
||||
pa1, pa2, pb1, pb2,
|
||||
ra1, ra2, rb1, rb2)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Segment>
|
||||
static inline return_type degenerate(Segment const& segment,
|
||||
bool a_degenerate)
|
||||
{
|
||||
return return_type
|
||||
(
|
||||
pts_policy::degenerate(segment, a_degenerate),
|
||||
dir_policy::degenerate(segment, a_degenerate)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Segment, typename Ratio>
|
||||
static inline return_type one_degenerate(Segment const& segment,
|
||||
Ratio const& ratio,
|
||||
bool a_degenerate)
|
||||
{
|
||||
return return_type
|
||||
(
|
||||
pts_policy::one_degenerate(segment, ratio, a_degenerate),
|
||||
dir_policy::one_degenerate(segment, ratio, a_degenerate)
|
||||
);
|
||||
}
|
||||
|
||||
static inline return_type disjoint()
|
||||
{
|
||||
return return_type
|
||||
(
|
||||
pts_policy::disjoint(),
|
||||
dir_policy::disjoint()
|
||||
);
|
||||
}
|
||||
|
||||
static inline return_type error(std::string const& msg)
|
||||
{
|
||||
return return_type
|
||||
(
|
||||
pts_policy::error(msg),
|
||||
dir_policy::error(msg)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}} // namespace policies::relate
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POLICY_HPP
|
||||
@@ -1,116 +0,0 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_TUPLED_HPP
|
||||
#define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_TUPLED_HPP
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/geometry/strategies/side_info.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace policies { namespace relate
|
||||
{
|
||||
|
||||
|
||||
// "tupled" to return intersection results together.
|
||||
// Now with two, with some meta-programming and derivations it can also be three (or more)
|
||||
template <typename Policy1, typename Policy2>
|
||||
struct segments_tupled
|
||||
{
|
||||
typedef boost::tuple
|
||||
<
|
||||
typename Policy1::return_type,
|
||||
typename Policy2::return_type
|
||||
> return_type;
|
||||
|
||||
template <typename Segment1, typename Segment2, typename SegmentIntersectionInfo>
|
||||
static inline return_type segments_crosses(side_info const& sides,
|
||||
SegmentIntersectionInfo const& sinfo,
|
||||
Segment1 const& s1, Segment2 const& s2)
|
||||
{
|
||||
return boost::make_tuple
|
||||
(
|
||||
Policy1::segments_crosses(sides, sinfo, s1, s2),
|
||||
Policy2::segments_crosses(sides, sinfo, s1, s2)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Segment1, typename Segment2, typename Ratio>
|
||||
static inline return_type segments_collinear(
|
||||
Segment1 const& segment1, Segment2 const& segment2,
|
||||
bool opposite,
|
||||
int pa1, int pa2, int pb1, int pb2,
|
||||
Ratio const& ra1, Ratio const& ra2,
|
||||
Ratio const& rb1, Ratio const& rb2)
|
||||
{
|
||||
return boost::make_tuple
|
||||
(
|
||||
Policy1::segments_collinear(segment1, segment2,
|
||||
opposite,
|
||||
pa1, pa2, pb1, pb2,
|
||||
ra1, ra2, rb1, rb2),
|
||||
Policy2::segments_collinear(segment1, segment2,
|
||||
opposite,
|
||||
pa1, pa2, pb1, pb2,
|
||||
ra1, ra2, rb1, rb2)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Segment>
|
||||
static inline return_type degenerate(Segment const& segment,
|
||||
bool a_degenerate)
|
||||
{
|
||||
return boost::make_tuple
|
||||
(
|
||||
Policy1::degenerate(segment, a_degenerate),
|
||||
Policy2::degenerate(segment, a_degenerate)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Segment, typename Ratio>
|
||||
static inline return_type one_degenerate(Segment const& segment,
|
||||
Ratio const& ratio,
|
||||
bool a_degenerate)
|
||||
{
|
||||
return boost::make_tuple
|
||||
(
|
||||
Policy1::one_degenerate(segment, ratio, a_degenerate),
|
||||
Policy2::one_degenerate(segment, ratio, a_degenerate)
|
||||
);
|
||||
}
|
||||
|
||||
static inline return_type disjoint()
|
||||
{
|
||||
return boost::make_tuple
|
||||
(
|
||||
Policy1::disjoint(),
|
||||
Policy2::disjoint()
|
||||
);
|
||||
}
|
||||
|
||||
static inline return_type error(std::string const& msg)
|
||||
{
|
||||
return boost::make_tuple
|
||||
(
|
||||
Policy1::error(msg),
|
||||
Policy2::error(msg)
|
||||
);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}} // namespace policies::relate
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_TUPLED_HPP
|
||||
@@ -5,10 +5,11 @@
|
||||
// Copyright (c) 2014-2015 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2014-2015 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2015.
|
||||
// Modifications copyright (c) 2015, Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2015-2020.
|
||||
// Modifications copyright (c) 2015-2020, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -19,13 +20,11 @@
|
||||
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/geometry/core/assert.hpp>
|
||||
#include <boost/geometry/core/config.hpp>
|
||||
#include <boost/geometry/core/coordinate_promotion.hpp>
|
||||
#include <boost/geometry/core/tag_cast.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/envelope.hpp>
|
||||
@@ -33,15 +32,19 @@
|
||||
#include <boost/geometry/algorithms/is_empty.hpp>
|
||||
#include <boost/geometry/algorithms/detail/recalculate.hpp>
|
||||
#include <boost/geometry/algorithms/detail/get_max_size.hpp>
|
||||
#include <boost/geometry/policies/robustness/robust_type.hpp>
|
||||
|
||||
#include <boost/geometry/core/static_assert.hpp>
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
|
||||
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
|
||||
#include <boost/geometry/policies/robustness/rescale_policy.hpp>
|
||||
#include <boost/geometry/policies/robustness/robust_type.hpp>
|
||||
#include <boost/geometry/util/type_traits.hpp>
|
||||
|
||||
// TEMP
|
||||
#include <boost/geometry/strategies/envelope/cartesian.hpp>
|
||||
#include <boost/geometry/strategies/envelope/geographic.hpp>
|
||||
#include <boost/geometry/strategies/envelope/spherical.hpp>
|
||||
|
||||
#include <boost/geometry/util/promote_floating_point.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
@@ -91,29 +94,45 @@ inline void scale_box_to_integer_range(Box const& box,
|
||||
assign_values(min_robust_point, min_coordinate, min_coordinate);
|
||||
}
|
||||
|
||||
template <typename Point, typename RobustPoint, typename Geometry, typename Factor>
|
||||
template
|
||||
<
|
||||
typename Point, typename RobustPoint, typename Geometry,
|
||||
typename Factor, typename Strategy
|
||||
>
|
||||
static inline void init_rescale_policy(Geometry const& geometry,
|
||||
Point& min_point,
|
||||
RobustPoint& min_robust_point,
|
||||
Factor& factor)
|
||||
Factor& factor,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
if (geometry::is_empty(geometry))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get bounding boxes
|
||||
model::box<Point> env = geometry::return_envelope<model::box<Point> >(geometry);
|
||||
// Get bounding box
|
||||
model::box<Point> env = geometry::return_envelope
|
||||
<
|
||||
model::box<Point>
|
||||
>(geometry, strategy);
|
||||
|
||||
scale_box_to_integer_range(env, min_point, min_robust_point, factor);
|
||||
}
|
||||
|
||||
template <typename Point, typename RobustPoint, typename Geometry1, typename Geometry2, typename Factor>
|
||||
// NOTE: Actually it should take 2 separate strategies, one for each geometry
|
||||
// in case one of them was e.g. a Box
|
||||
template
|
||||
<
|
||||
typename Point, typename RobustPoint, typename Geometry1, typename Geometry2,
|
||||
typename Factor, typename Strategy1, typename Strategy2
|
||||
>
|
||||
static inline void init_rescale_policy(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
Point& min_point,
|
||||
RobustPoint& min_robust_point,
|
||||
Factor& factor)
|
||||
Factor& factor,
|
||||
Strategy1 const& strategy1,
|
||||
Strategy2 const& strategy2)
|
||||
{
|
||||
// Get bounding boxes (when at least one of the geometries is not empty)
|
||||
bool const is_empty1 = geometry::is_empty(geometry1);
|
||||
@@ -126,11 +145,11 @@ static inline void init_rescale_policy(Geometry1 const& geometry1,
|
||||
model::box<Point> env;
|
||||
if (is_empty1)
|
||||
{
|
||||
geometry::envelope(geometry2, env);
|
||||
geometry::envelope(geometry2, env, strategy2);
|
||||
}
|
||||
else if (is_empty2)
|
||||
{
|
||||
geometry::envelope(geometry1, env);
|
||||
geometry::envelope(geometry1, env, strategy1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -138,12 +157,12 @@ static inline void init_rescale_policy(Geometry1 const& geometry1,
|
||||
// optimal MBR when then two geometries are in the spherical
|
||||
// equatorial or geographic coordinate systems.
|
||||
// TODO: implement envelope for two (or possibly more geometries)
|
||||
geometry::envelope(geometry1, env);
|
||||
geometry::envelope(geometry1, env, strategy1);
|
||||
model::box<Point> env2 = geometry::return_envelope
|
||||
<
|
||||
model::box<Point>
|
||||
>(geometry2);
|
||||
geometry::expand(env, env2);
|
||||
>(geometry2, strategy2);
|
||||
geometry::expand(env, env2, strategy1);
|
||||
}
|
||||
|
||||
scale_box_to_integer_range(env, min_point, min_robust_point, factor);
|
||||
@@ -181,8 +200,9 @@ struct rescale_policy_type<Point, true>
|
||||
template <typename Policy>
|
||||
struct get_rescale_policy
|
||||
{
|
||||
template <typename Geometry>
|
||||
static inline Policy apply(Geometry const& geometry)
|
||||
template <typename Geometry, typename Strategy>
|
||||
static inline Policy apply(Geometry const& geometry,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
typedef typename point_type<Geometry>::type point_type;
|
||||
typedef typename geometry::coordinate_type<Geometry>::type coordinate_type;
|
||||
@@ -197,13 +217,16 @@ struct get_rescale_policy
|
||||
point_type min_point;
|
||||
robust_point_type min_robust_point;
|
||||
factor_type factor;
|
||||
init_rescale_policy(geometry, min_point, min_robust_point, factor);
|
||||
init_rescale_policy(geometry, min_point, min_robust_point,
|
||||
factor, strategy);
|
||||
|
||||
return Policy(min_point, min_robust_point, factor);
|
||||
}
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
static inline Policy apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
|
||||
template <typename Geometry1, typename Geometry2, typename Strategy1, typename Strategy2>
|
||||
static inline Policy apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
|
||||
Strategy1 const& strategy1,
|
||||
Strategy2 const& strategy2)
|
||||
{
|
||||
typedef typename point_type<Geometry1>::type point_type;
|
||||
typedef typename geometry::coordinate_type<Geometry1>::type coordinate_type;
|
||||
@@ -218,7 +241,8 @@ struct get_rescale_policy
|
||||
point_type min_point;
|
||||
robust_point_type min_robust_point;
|
||||
factor_type factor;
|
||||
init_rescale_policy(geometry1, geometry2, min_point, min_robust_point, factor);
|
||||
init_rescale_policy(geometry1, geometry2, min_point, min_robust_point,
|
||||
factor, strategy1, strategy2);
|
||||
|
||||
return Policy(min_point, min_robust_point, factor);
|
||||
}
|
||||
@@ -228,14 +252,15 @@ struct get_rescale_policy
|
||||
template <>
|
||||
struct get_rescale_policy<no_rescale_policy>
|
||||
{
|
||||
template <typename Geometry>
|
||||
static inline no_rescale_policy apply(Geometry const& )
|
||||
template <typename Geometry, typename EnvelopeStrategy>
|
||||
static inline no_rescale_policy apply(Geometry const& , EnvelopeStrategy const&)
|
||||
{
|
||||
return no_rescale_policy();
|
||||
}
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
static inline no_rescale_policy apply(Geometry1 const& , Geometry2 const& )
|
||||
template <typename Geometry1, typename Geometry2, typename EnvelopeStrategy1, typename EnvelopeStrategy2>
|
||||
static inline no_rescale_policy apply(Geometry1 const& , Geometry2 const& ,
|
||||
EnvelopeStrategy1 const& , EnvelopeStrategy2 const& )
|
||||
{
|
||||
return no_rescale_policy();
|
||||
}
|
||||
@@ -245,37 +270,35 @@ struct get_rescale_policy<no_rescale_policy>
|
||||
}} // namespace detail::get_rescale_policy
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
template<typename Point>
|
||||
template
|
||||
<
|
||||
typename Point,
|
||||
typename CSTag = typename geometry::cs_tag<Point>::type
|
||||
>
|
||||
struct rescale_policy_type
|
||||
: public detail::get_rescale_policy::rescale_policy_type
|
||||
<
|
||||
Point,
|
||||
#if defined(BOOST_GEOMETRY_USE_RESCALING)
|
||||
boost::is_floating_point
|
||||
std::is_floating_point
|
||||
<
|
||||
typename geometry::coordinate_type<Point>::type
|
||||
>::type::value
|
||||
&&
|
||||
boost::is_same
|
||||
std::is_same
|
||||
<
|
||||
typename geometry::coordinate_system<Point>::type,
|
||||
geometry::cs::cartesian
|
||||
CSTag,
|
||||
geometry::cartesian_tag
|
||||
>::value
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
>
|
||||
{
|
||||
static const bool is_point
|
||||
= boost::is_same
|
||||
<
|
||||
typename geometry::tag<Point>::type,
|
||||
geometry::point_tag
|
||||
>::type::value;
|
||||
|
||||
BOOST_MPL_ASSERT_MSG((is_point),
|
||||
INVALID_INPUT_GEOMETRY,
|
||||
(typename geometry::tag<Point>::type));
|
||||
BOOST_GEOMETRY_STATIC_ASSERT(
|
||||
(util::is_point<Point>::value),
|
||||
"Point type expected.",
|
||||
Point);
|
||||
};
|
||||
|
||||
|
||||
@@ -283,6 +306,7 @@ template
|
||||
<
|
||||
typename Geometry1,
|
||||
typename Geometry2,
|
||||
typename CSTag = typename geometry::cs_tag<Geometry1>::type,
|
||||
typename Tag1 = typename tag_cast
|
||||
<
|
||||
typename tag<Geometry1>::type,
|
||||
@@ -313,12 +337,14 @@ struct rescale_overlay_policy_type
|
||||
template
|
||||
<
|
||||
typename Geometry1,
|
||||
typename Geometry2
|
||||
typename Geometry2,
|
||||
typename CSTag
|
||||
>
|
||||
struct rescale_overlay_policy_type<Geometry1, Geometry2, areal_tag, areal_tag>
|
||||
struct rescale_overlay_policy_type<Geometry1, Geometry2, CSTag, areal_tag, areal_tag>
|
||||
: public rescale_policy_type
|
||||
<
|
||||
typename geometry::point_type<Geometry1>::type
|
||||
typename geometry::point_type<Geometry1>::type,
|
||||
CSTag
|
||||
>
|
||||
{};
|
||||
|
||||
@@ -326,13 +352,60 @@ struct rescale_overlay_policy_type<Geometry1, Geometry2, areal_tag, areal_tag>
|
||||
template <typename Policy, typename Geometry>
|
||||
inline Policy get_rescale_policy(Geometry const& geometry)
|
||||
{
|
||||
return detail::get_rescale_policy::get_rescale_policy<Policy>::apply(geometry);
|
||||
typename geometry::strategies::envelope::services::default_strategy
|
||||
<
|
||||
Geometry,
|
||||
model::box<typename point_type<Geometry>::type>
|
||||
>::type strategy;
|
||||
|
||||
return detail::get_rescale_policy::get_rescale_policy<Policy>::apply(geometry, strategy);
|
||||
}
|
||||
|
||||
template <typename Policy, typename Geometry1, typename Geometry2>
|
||||
template
|
||||
<
|
||||
typename Policy, typename Geometry, typename Strategy,
|
||||
std::enable_if_t<std::is_void<typename geometry::tag<Strategy>::type>::value, int> = 0
|
||||
>
|
||||
inline Policy get_rescale_policy(Geometry const& geometry, Strategy const& strategy)
|
||||
{
|
||||
return detail::get_rescale_policy::get_rescale_policy
|
||||
<
|
||||
Policy
|
||||
>::apply(geometry, strategy);
|
||||
}
|
||||
|
||||
template
|
||||
<
|
||||
typename Policy, typename Geometry1, typename Geometry2,
|
||||
std::enable_if_t<! std::is_void<typename geometry::tag<Geometry2>::type>::value, int> = 0
|
||||
>
|
||||
inline Policy get_rescale_policy(Geometry1 const& geometry1, Geometry2 const& geometry2)
|
||||
{
|
||||
return detail::get_rescale_policy::get_rescale_policy<Policy>::apply(geometry1, geometry2);
|
||||
typename geometry::strategies::envelope::services::default_strategy
|
||||
<
|
||||
Geometry1,
|
||||
model::box<typename point_type<Geometry1>::type>
|
||||
>::type strategy1;
|
||||
typename geometry::strategies::envelope::services::default_strategy
|
||||
<
|
||||
Geometry2,
|
||||
model::box<typename point_type<Geometry2>::type>
|
||||
>::type strategy2;
|
||||
|
||||
return detail::get_rescale_policy::get_rescale_policy
|
||||
<
|
||||
Policy
|
||||
>::apply(geometry1, geometry2, strategy1, strategy2);
|
||||
}
|
||||
|
||||
template <typename Policy, typename Geometry1, typename Geometry2, typename Strategy>
|
||||
inline Policy get_rescale_policy(Geometry1 const& geometry1, Geometry2 const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
return detail::get_rescale_policy::get_rescale_policy
|
||||
<
|
||||
Policy
|
||||
>::apply(geometry1, geometry2, strategy, strategy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
|
||||
#include <boost/geometry/policies/robustness/segment_ratio.hpp>
|
||||
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
@@ -26,7 +25,7 @@ namespace boost { namespace geometry
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Probably this will be moved out of namespace detail
|
||||
// Redudant later.
|
||||
struct no_rescale_policy
|
||||
{
|
||||
static bool const enabled = false;
|
||||
@@ -51,16 +50,6 @@ struct robust_point_type<Point, detail::no_rescale_policy>
|
||||
typedef Point type;
|
||||
};
|
||||
|
||||
template <typename Point>
|
||||
struct segment_ratio_type<Point, detail::no_rescale_policy>
|
||||
{
|
||||
// Define a segment_ratio defined on coordinate type, e.g.
|
||||
// int/int or float/float
|
||||
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
|
||||
typedef segment_ratio<coordinate_type> type;
|
||||
};
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_NO_RESCALE_POLICY_HPP
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
|
||||
#include <boost/geometry/policies/robustness/segment_ratio.hpp>
|
||||
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
|
||||
#include <boost/geometry/policies/robustness/robust_point_type.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
@@ -77,13 +76,6 @@ struct robust_point_type<Point, detail::robust_policy<FpPoint, IntPoint, Calcula
|
||||
typedef IntPoint type;
|
||||
};
|
||||
|
||||
// Meta function for rescaling, if rescaling is done segment_ratio is based on long long
|
||||
template <typename Point, typename FpPoint, typename IntPoint, typename CalculationType>
|
||||
struct segment_ratio_type<Point, detail::robust_policy<FpPoint, IntPoint, CalculationType> >
|
||||
{
|
||||
typedef segment_ratio<boost::long_long_type> type;
|
||||
};
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 2019-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP
|
||||
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP
|
||||
|
||||
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct no_rescale_policy_tag {};
|
||||
struct rescale_policy_tag {};
|
||||
|
||||
template <typename RobustPolicy>
|
||||
struct rescale_policy_type
|
||||
{
|
||||
typedef rescale_policy_tag type;
|
||||
};
|
||||
|
||||
// Specialization
|
||||
template <>
|
||||
struct rescale_policy_type<no_rescale_policy>
|
||||
{
|
||||
typedef no_rescale_policy_tag type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
#endif
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_RESCALE_POLICY_TYPE_HPP
|
||||
@@ -5,6 +5,10 @@
|
||||
// Copyright (c) 2014 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2020.
|
||||
// Modifications copyright (c) 2020, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -13,8 +17,9 @@
|
||||
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP
|
||||
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@@ -31,13 +36,13 @@ struct robust_type
|
||||
};
|
||||
|
||||
template <typename CoordinateType>
|
||||
struct robust_type<CoordinateType, boost::false_type>
|
||||
struct robust_type<CoordinateType, std::false_type>
|
||||
{
|
||||
typedef CoordinateType type;
|
||||
};
|
||||
|
||||
template <typename CoordinateType>
|
||||
struct robust_type<CoordinateType, boost::true_type>
|
||||
struct robust_type<CoordinateType, std::true_type>
|
||||
{
|
||||
typedef boost::long_long_type type;
|
||||
};
|
||||
@@ -53,7 +58,7 @@ struct robust_type
|
||||
typedef typename detail_dispatch::robust_type
|
||||
<
|
||||
CoordinateType,
|
||||
typename boost::is_floating_point<CoordinateType>::type
|
||||
typename std::is_floating_point<CoordinateType>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016 Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2016-2021.
|
||||
// Modifications copyright (c) 2016-2021 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
@@ -13,12 +13,14 @@
|
||||
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_HPP
|
||||
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_HPP
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/rational.hpp>
|
||||
|
||||
#include <boost/geometry/core/assert.hpp>
|
||||
#include <boost/geometry/core/coordinate_promotion.hpp>
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/geometry/util/promote_floating_point.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
@@ -30,7 +32,7 @@ namespace detail { namespace segment_ratio
|
||||
template
|
||||
<
|
||||
typename Type,
|
||||
bool IsIntegral = boost::is_integral<Type>::type::value
|
||||
bool IsIntegral = std::is_integral<Type>::type::value
|
||||
>
|
||||
struct less {};
|
||||
|
||||
@@ -51,17 +53,19 @@ struct less<Type, false>
|
||||
template <typename Ratio>
|
||||
static inline bool apply(Ratio const& lhs, Ratio const& rhs)
|
||||
{
|
||||
BOOST_GEOMETRY_ASSERT(lhs.denominator() != 0);
|
||||
BOOST_GEOMETRY_ASSERT(rhs.denominator() != 0);
|
||||
return lhs.numerator() * rhs.denominator()
|
||||
< rhs.numerator() * lhs.denominator();
|
||||
BOOST_GEOMETRY_ASSERT(lhs.denominator() != Type(0));
|
||||
BOOST_GEOMETRY_ASSERT(rhs.denominator() != Type(0));
|
||||
Type const a = lhs.numerator() / lhs.denominator();
|
||||
Type const b = rhs.numerator() / rhs.denominator();
|
||||
return ! geometry::math::equals(a, b)
|
||||
&& a < b;
|
||||
}
|
||||
};
|
||||
|
||||
template
|
||||
<
|
||||
typename Type,
|
||||
bool IsIntegral = boost::is_integral<Type>::type::value
|
||||
bool IsIntegral = std::is_integral<Type>::type::value
|
||||
>
|
||||
struct equal {};
|
||||
|
||||
@@ -82,13 +86,41 @@ struct equal<Type, false>
|
||||
template <typename Ratio>
|
||||
static inline bool apply(Ratio const& lhs, Ratio const& rhs)
|
||||
{
|
||||
BOOST_GEOMETRY_ASSERT(lhs.denominator() != 0);
|
||||
BOOST_GEOMETRY_ASSERT(rhs.denominator() != 0);
|
||||
return geometry::math::equals
|
||||
(
|
||||
lhs.numerator() * rhs.denominator(),
|
||||
rhs.numerator() * lhs.denominator()
|
||||
);
|
||||
BOOST_GEOMETRY_ASSERT(lhs.denominator() != Type(0));
|
||||
BOOST_GEOMETRY_ASSERT(rhs.denominator() != Type(0));
|
||||
Type const a = lhs.numerator() / lhs.denominator();
|
||||
Type const b = rhs.numerator() / rhs.denominator();
|
||||
return geometry::math::equals(a, b);
|
||||
}
|
||||
};
|
||||
|
||||
template
|
||||
<
|
||||
typename Type,
|
||||
bool IsFloatingPoint = std::is_floating_point<Type>::type::value
|
||||
>
|
||||
struct possibly_collinear {};
|
||||
|
||||
template <typename Type>
|
||||
struct possibly_collinear<Type, true>
|
||||
{
|
||||
template <typename Ratio, typename Threshold>
|
||||
static inline bool apply(Ratio const& ratio, Threshold threshold)
|
||||
{
|
||||
return std::abs(ratio.denominator()) < threshold;
|
||||
}
|
||||
};
|
||||
|
||||
// Any ratio based on non-floating point (or user defined floating point)
|
||||
// is collinear if the denominator is exactly zero
|
||||
template <typename Type>
|
||||
struct possibly_collinear<Type, false>
|
||||
{
|
||||
template <typename Ratio, typename Threshold>
|
||||
static inline bool apply(Ratio const& ratio, Threshold)
|
||||
{
|
||||
static Type const zero = 0;
|
||||
return ratio.denominator() == zero;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -104,11 +136,16 @@ struct equal<Type, false>
|
||||
template <typename Type>
|
||||
class segment_ratio
|
||||
{
|
||||
public :
|
||||
typedef Type numeric_type;
|
||||
// Type used for the approximation (a helper value)
|
||||
// and for the edge value (0..1) (a helper function).
|
||||
using floating_point_type =
|
||||
typename detail::promoted_to_floating_point<Type>::type;
|
||||
|
||||
// Type-alias for the type itself
|
||||
typedef segment_ratio<Type> thistype;
|
||||
using thistype = segment_ratio<Type>;
|
||||
|
||||
public:
|
||||
using int_type = Type;
|
||||
|
||||
inline segment_ratio()
|
||||
: m_numerator(0)
|
||||
@@ -116,19 +153,63 @@ public :
|
||||
, m_approximation(0)
|
||||
{}
|
||||
|
||||
inline segment_ratio(const Type& nominator, const Type& denominator)
|
||||
: m_numerator(nominator)
|
||||
inline segment_ratio(const Type& numerator, const Type& denominator)
|
||||
: m_numerator(numerator)
|
||||
, m_denominator(denominator)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
segment_ratio(segment_ratio const&) = default;
|
||||
segment_ratio& operator=(segment_ratio const&) = default;
|
||||
segment_ratio(segment_ratio&&) = default;
|
||||
segment_ratio& operator=(segment_ratio&&) = default;
|
||||
|
||||
// These are needed because in intersection strategies ratios are assigned
|
||||
// in fractions and if a user passes CalculationType then ratio Type in
|
||||
// turns is taken from geometry coordinate_type and the one used in
|
||||
// a strategy uses Type selected using CalculationType.
|
||||
// See: detail::overlay::intersection_info_base
|
||||
// and policies::relate::segments_intersection_points
|
||||
// in particular segments_collinear() where ratios are assigned.
|
||||
template<typename T> friend class segment_ratio;
|
||||
template <typename T>
|
||||
segment_ratio(segment_ratio<T> const& r)
|
||||
: m_numerator(r.m_numerator)
|
||||
, m_denominator(r.m_denominator)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
template <typename T>
|
||||
segment_ratio& operator=(segment_ratio<T> const& r)
|
||||
{
|
||||
m_numerator = r.m_numerator;
|
||||
m_denominator = r.m_denominator;
|
||||
initialize();
|
||||
return *this;
|
||||
}
|
||||
template <typename T>
|
||||
segment_ratio(segment_ratio<T> && r)
|
||||
: m_numerator(std::move(r.m_numerator))
|
||||
, m_denominator(std::move(r.m_denominator))
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
template <typename T>
|
||||
segment_ratio& operator=(segment_ratio<T> && r)
|
||||
{
|
||||
m_numerator = std::move(r.m_numerator);
|
||||
m_denominator = std::move(r.m_denominator);
|
||||
initialize();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Type const& numerator() const { return m_numerator; }
|
||||
inline Type const& denominator() const { return m_denominator; }
|
||||
|
||||
inline void assign(const Type& nominator, const Type& denominator)
|
||||
inline void assign(const Type& numerator, const Type& denominator)
|
||||
{
|
||||
m_numerator = nominator;
|
||||
m_numerator = numerator;
|
||||
m_denominator = denominator;
|
||||
initialize();
|
||||
}
|
||||
@@ -137,31 +218,31 @@ public :
|
||||
{
|
||||
// Minimal normalization
|
||||
// 1/-4 => -1/4, -1/-4 => 1/4
|
||||
if (m_denominator < 0)
|
||||
if (m_denominator < zero_instance())
|
||||
{
|
||||
m_numerator = -m_numerator;
|
||||
m_denominator = -m_denominator;
|
||||
}
|
||||
|
||||
m_approximation =
|
||||
m_denominator == 0 ? 0
|
||||
m_denominator == zero_instance() ? floating_point_type{0}
|
||||
: (
|
||||
boost::numeric_cast<fp_type>(m_numerator) * scale()
|
||||
/ boost::numeric_cast<fp_type>(m_denominator)
|
||||
boost::numeric_cast<floating_point_type>(m_numerator) * scale()
|
||||
/ boost::numeric_cast<floating_point_type>(m_denominator)
|
||||
);
|
||||
}
|
||||
|
||||
inline bool is_zero() const { return math::equals(m_numerator, 0); }
|
||||
inline bool is_zero() const { return math::equals(m_numerator, Type(0)); }
|
||||
inline bool is_one() const { return math::equals(m_numerator, m_denominator); }
|
||||
inline bool on_segment() const
|
||||
{
|
||||
// e.g. 0/4 or 4/4 or 2/4
|
||||
return m_numerator >= 0 && m_numerator <= m_denominator;
|
||||
return m_numerator >= zero_instance() && m_numerator <= m_denominator;
|
||||
}
|
||||
inline bool in_segment() const
|
||||
{
|
||||
// e.g. 1/4
|
||||
return m_numerator > 0 && m_numerator < m_denominator;
|
||||
return m_numerator > zero_instance() && m_numerator < m_denominator;
|
||||
}
|
||||
inline bool on_end() const
|
||||
{
|
||||
@@ -171,7 +252,7 @@ public :
|
||||
inline bool left() const
|
||||
{
|
||||
// e.g. -1/4
|
||||
return m_numerator < 0;
|
||||
return m_numerator < zero_instance();
|
||||
}
|
||||
inline bool right() const
|
||||
{
|
||||
@@ -179,21 +260,22 @@ public :
|
||||
return m_numerator > m_denominator;
|
||||
}
|
||||
|
||||
inline bool near_end() const
|
||||
//! Returns a value between 0.0 and 1.0
|
||||
//! 0.0 means: exactly in the middle
|
||||
//! 1.0 means: exactly on one of the edges (or even over it)
|
||||
inline floating_point_type edge_value() const
|
||||
{
|
||||
if (left() || right())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static fp_type const small_part_of_scale = scale() / 100;
|
||||
return m_approximation < small_part_of_scale
|
||||
|| m_approximation > scale() - small_part_of_scale;
|
||||
using fp = floating_point_type;
|
||||
fp const one{1.0};
|
||||
floating_point_type const result
|
||||
= fp(2) * geometry::math::abs(fp(0.5) - m_approximation / scale());
|
||||
return result > one ? one : result;
|
||||
}
|
||||
|
||||
inline bool close_to(thistype const& other) const
|
||||
template <typename Threshold>
|
||||
inline bool possibly_collinear(Threshold threshold) const
|
||||
{
|
||||
return geometry::math::abs(m_approximation - other.m_approximation) < 50;
|
||||
return detail::segment_ratio::possibly_collinear<Type>::apply(*this, threshold);
|
||||
}
|
||||
|
||||
inline bool operator< (thistype const& other) const
|
||||
@@ -232,17 +314,7 @@ public :
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
private :
|
||||
// NOTE: if this typedef is used then fp_type is non-fundamental type
|
||||
// if Type is non-fundamental type
|
||||
//typedef typename promote_floating_point<Type>::type fp_type;
|
||||
|
||||
typedef typename boost::mpl::if_c
|
||||
<
|
||||
boost::is_float<Type>::value, Type, double
|
||||
>::type fp_type;
|
||||
|
||||
Type m_numerator;
|
||||
Type m_denominator;
|
||||
@@ -252,12 +324,24 @@ private :
|
||||
// Boost.Rational is used if the approximations are close.
|
||||
// Reason: performance, Boost.Rational does a GCD by default and also the
|
||||
// comparisons contain while-loops.
|
||||
fp_type m_approximation;
|
||||
floating_point_type m_approximation;
|
||||
|
||||
|
||||
static inline fp_type scale()
|
||||
inline bool close_to(thistype const& other) const
|
||||
{
|
||||
return 1000000.0;
|
||||
static floating_point_type const threshold{50.0};
|
||||
return geometry::math::abs(m_approximation - other.m_approximation)
|
||||
< threshold;
|
||||
}
|
||||
|
||||
static inline floating_point_type scale()
|
||||
{
|
||||
static floating_point_type const fp_scale{1000000.0};
|
||||
return fp_scale;
|
||||
}
|
||||
|
||||
static inline Type zero_instance()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
// Copyright (c) 2013 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2020.
|
||||
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -12,17 +16,39 @@
|
||||
#ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP
|
||||
#define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP
|
||||
|
||||
#include <boost/geometry/algorithms/not_implemented.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
|
||||
|
||||
namespace boost { namespace geometry { namespace detail
|
||||
{
|
||||
|
||||
// Meta-function to access segment-ratio for a policy
|
||||
// Temporary meta-function to access segment-ratio for a policy
|
||||
template <typename Point, typename Policy>
|
||||
struct segment_ratio_type {}; // : not_implemented<> {};
|
||||
struct segment_ratio_type
|
||||
{
|
||||
// Type in segment ratio is either the coordinate type, or for
|
||||
// deprecated robust point types it is a long_long type
|
||||
typedef std::conditional_t
|
||||
<
|
||||
std::is_same
|
||||
<
|
||||
typename rescale_policy_type<Policy>::type,
|
||||
no_rescale_policy_tag
|
||||
>::value,
|
||||
typename geometry::coordinate_type<Point>::type,
|
||||
boost::long_long_type
|
||||
> coordinate_type;
|
||||
|
||||
// Define segment ratio based on the coordinate type
|
||||
typedef geometry::segment_ratio<coordinate_type> type;
|
||||
};
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
}}} // namespace boost::geometry::deatil
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP
|
||||
|
||||
Reference in New Issue
Block a user