mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-12 00:02:09 +00:00
[geometry] Use segment_ratio_type metafunction in handle_tangencies,
disjoint, add policy_type to intersection strategy with 2 segments
This commit is contained in:
@@ -128,7 +128,10 @@ private :
|
||||
typedef segment_intersection_points
|
||||
<
|
||||
point_type,
|
||||
segment_ratio<boost::long_long_type> // TODO finetune this
|
||||
typename segment_ratio_type
|
||||
<
|
||||
point_type, RescalePolicy
|
||||
>::type
|
||||
> intersection_return_type;
|
||||
|
||||
typedef strategy::intersection::relate_cartesian_segments
|
||||
|
||||
@@ -85,7 +85,10 @@ struct intersection_segment_segment_point
|
||||
typedef segment_intersection_points
|
||||
<
|
||||
point_type,
|
||||
segment_ratio<boost::long_long_type> // TODO finetune this
|
||||
typename segment_ratio_type
|
||||
<
|
||||
point_type, RescalePolicy
|
||||
>::type
|
||||
> intersection_return_type;
|
||||
|
||||
typedef strategy::intersection::relate_cartesian_segments
|
||||
|
||||
@@ -146,10 +146,18 @@ struct disjoint_segment
|
||||
{
|
||||
typedef typename point_type<Segment1>::type point_type;
|
||||
|
||||
// We don't need to rescale to detect disjointness
|
||||
typedef no_rescale_policy rescale_policy_type;
|
||||
rescale_policy_type rescale_policy;
|
||||
|
||||
typedef segment_intersection_points
|
||||
<
|
||||
point_type,
|
||||
segment_ratio<boost::long_long_type> // TODO finetune this
|
||||
typename segment_ratio_type
|
||||
<
|
||||
point_type,
|
||||
rescale_policy_type
|
||||
>::type
|
||||
> intersection_return_type;
|
||||
|
||||
intersection_return_type is
|
||||
@@ -159,7 +167,7 @@ struct disjoint_segment
|
||||
<
|
||||
intersection_return_type
|
||||
>
|
||||
>::apply(segment1, segment2);
|
||||
>::apply(segment1, segment2, rescale_policy);
|
||||
|
||||
return is.count == 0;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
// TODO move to policies folder
|
||||
#include <boost/geometry/algorithms/detail/rescale.hpp>
|
||||
#include <boost/geometry/algorithms/detail/recalculate.hpp>
|
||||
|
||||
|
||||
#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS)
|
||||
@@ -83,19 +84,32 @@ struct relate_cartesian_segments
|
||||
|
||||
|
||||
// Relate segments a and b
|
||||
template <typename Segment1, typename Segment2>
|
||||
static inline return_type apply(Segment1 const& a, Segment2 const& b)
|
||||
template <typename Segment1, typename Segment2, typename RobustPolicy>
|
||||
static inline return_type apply(Segment1 const& a, Segment2 const& b,
|
||||
RobustPolicy const& robust_policy)
|
||||
{
|
||||
// TODO: revise this or remove this overload
|
||||
// This considers two segments without robustness checks
|
||||
typename geometry::point_type<Segment1>::type a0, a1, b0, b1; // type them all as in first
|
||||
// type them all as in Segment1 - TODO reconsider this, most precise?
|
||||
typedef typename geometry::point_type<Segment1>::type point_type;
|
||||
|
||||
typedef typename geometry::robust_point_type
|
||||
<
|
||||
point_type, RobustPolicy
|
||||
>::type robust_point_type;
|
||||
|
||||
point_type a0, a1, b0, b1;
|
||||
robust_point_type a0_rob, a1_rob, b0_rob, b1_rob;
|
||||
|
||||
detail::assign_point_from_index<0>(a, a0);
|
||||
detail::assign_point_from_index<1>(a, a1);
|
||||
detail::assign_point_from_index<0>(b, b0);
|
||||
detail::assign_point_from_index<1>(b, b1);
|
||||
|
||||
geometry::detail::no_rescale_policy robust_policy;
|
||||
return apply(a, b, robust_policy, a0, a1, b0, b1);
|
||||
geometry::recalculate(a0_rob, a0, robust_policy);
|
||||
geometry::recalculate(a1_rob, a1, robust_policy);
|
||||
geometry::recalculate(b0_rob, b0, robust_policy);
|
||||
geometry::recalculate(b1_rob, b1, robust_policy);
|
||||
|
||||
return apply(a, b, robust_policy, a0_rob, a1_rob, b0_rob, b1_rob);
|
||||
}
|
||||
|
||||
// The main entry-routine, calculating intersections of segments a / b
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/segment_ratio.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user