mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-17 01:42:09 +00:00
[geometry] Fixes after merge in get_turns - use of arrivals, compilation fixes in relate, use of fractions for sorting turns in relate
This commit is contained in:
@@ -210,6 +210,7 @@ struct get_turn_info_for_endpoint
|
||||
return result_ignore_ip0 || result_ignore_ip1;
|
||||
}
|
||||
|
||||
// TODO remove how_a and how_b
|
||||
template<typename Point, typename Point1, typename Point2>
|
||||
static inline
|
||||
void handle_segment(bool /*first_a*/, bool last_a, int how_a, int arrival_a,
|
||||
@@ -238,8 +239,8 @@ struct get_turn_info_for_endpoint
|
||||
{
|
||||
op0_a = operation_intersection;
|
||||
op0_b = operation_intersection;
|
||||
op1_a = arrival_to_union_or_blocked(arrival_a, last_a);
|
||||
op1_b = arrival_to_union_or_blocked(arrival_b, last_b);
|
||||
op1_a = union_or_blocked_same_dirs(arrival_a, last_a);
|
||||
op1_b = union_or_blocked_same_dirs(arrival_b, last_b);
|
||||
|
||||
i0_a = equals::equals_point_point(pi, ip0);
|
||||
i0_b = equals::equals_point_point(qi, ip0);
|
||||
@@ -249,8 +250,8 @@ struct get_turn_info_for_endpoint
|
||||
else
|
||||
{
|
||||
op0_a = operation_intersection;
|
||||
op0_b = arrival_to_union_or_blocked(arrival_b, last_b);
|
||||
op1_a = arrival_to_union_or_blocked(arrival_a, last_a);
|
||||
op0_b = union_or_blocked_same_dirs(arrival_b, last_b);
|
||||
op1_a = union_or_blocked_same_dirs(arrival_a, last_a);
|
||||
op1_b = operation_intersection;
|
||||
|
||||
i0_a = arrival_b != 1;
|
||||
@@ -262,29 +263,29 @@ struct get_turn_info_for_endpoint
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(ip_count == 1);
|
||||
op0_a = arrival_to_union_or_blocked(arrival_a, last_a);
|
||||
op0_b = arrival_to_union_or_blocked(arrival_b, last_b);
|
||||
op0_a = union_or_blocked_same_dirs(arrival_a, last_a);
|
||||
op0_b = union_or_blocked_same_dirs(arrival_b, last_b);
|
||||
|
||||
i0_a = how_a == -1;
|
||||
i0_b = how_b == -1;
|
||||
i0_a = arrival_a == -1;
|
||||
i0_b = arrival_b == -1;
|
||||
j0_a = arrival_a == 0;
|
||||
j0_b = arrival_b == 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
op0_a = how_to_union_or_blocked(how_a, last_a);
|
||||
op0_b = how_to_union_or_blocked(how_b, last_b);
|
||||
op0_a = union_or_blocked_different_dirs(arrival_a, last_a);
|
||||
op0_b = union_or_blocked_different_dirs(arrival_b, last_b);
|
||||
|
||||
i0_a = how_a == -1;
|
||||
i0_b = how_b == -1;
|
||||
j0_a = how_a == 1;
|
||||
j0_b = how_b == 1;
|
||||
i0_a = arrival_a == -1;
|
||||
i0_b = arrival_b == -1;
|
||||
j0_a = arrival_a == 1;
|
||||
j0_b = arrival_b == 1;
|
||||
}
|
||||
}
|
||||
|
||||
// only if collinear (same_dirs)
|
||||
static inline operation_type arrival_to_union_or_blocked(int arrival, bool is_last)
|
||||
static inline operation_type union_or_blocked_same_dirs(int arrival, bool is_last)
|
||||
{
|
||||
if ( arrival == 1 )
|
||||
return operation_blocked;
|
||||
@@ -296,9 +297,9 @@ struct get_turn_info_for_endpoint
|
||||
}
|
||||
|
||||
// only if not collinear (!same_dirs)
|
||||
static inline operation_type how_to_union_or_blocked(int how, bool is_last)
|
||||
static inline operation_type union_or_blocked_different_dirs(int arrival, bool is_last)
|
||||
{
|
||||
if ( how == 1 )
|
||||
if ( arrival == 1 )
|
||||
//return operation_blocked;
|
||||
return is_last ? operation_blocked : operation_union;
|
||||
else
|
||||
|
||||
@@ -817,7 +817,7 @@ template <typename Geometry1, typename Geometry2, typename SegmentRatio,
|
||||
typename TagBase1 = typename topological_tag_base<Geometry1>::type, typename TagBase2 = typename topological_tag_base<Geometry2>::type>
|
||||
struct turn_operation_type
|
||||
{
|
||||
typedef overlay::turn_operation<SegmentRatio> type;
|
||||
typedef overlay::turn_operation<SegmentRatio> type;
|
||||
};
|
||||
|
||||
template <typename Geometry1, typename Geometry2, typename SegmentRatio, typename Tag1, typename Tag2>
|
||||
|
||||
@@ -74,6 +74,19 @@ template <typename Geometry1,
|
||||
= detail::get_turns::get_turn_info_type<Geometry1, Geometry2, overlay::assign_null_policy> >
|
||||
struct get_turns
|
||||
{
|
||||
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
||||
|
||||
typedef overlay::turn_info
|
||||
<
|
||||
point1_type,
|
||||
typename segment_ratio_type<point1_type, detail::no_rescale_policy>::type,
|
||||
enriched_turn_operation_linear
|
||||
<
|
||||
point1_type,
|
||||
typename segment_ratio_type<point1_type, detail::no_rescale_policy>::type
|
||||
>
|
||||
> turn_info;
|
||||
|
||||
template <typename Turns>
|
||||
static inline void apply(Turns & turns,
|
||||
Geometry1 const& geometry1,
|
||||
@@ -84,25 +97,14 @@ struct get_turns
|
||||
apply(turns, geometry1, geometry2, interrupt_policy);
|
||||
}
|
||||
|
||||
template <typename Turns, typename RobustPolicy, typename InterruptPolicy>
|
||||
template <typename Turns, typename InterruptPolicy>
|
||||
static inline void apply(Turns & turns,
|
||||
Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
RobustPolicy const& ,
|
||||
InterruptPolicy & interrupt_policy)
|
||||
{
|
||||
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
||||
|
||||
typedef overlay::turn_info
|
||||
<
|
||||
point1_type,
|
||||
enriched_turn_operation_linear
|
||||
<
|
||||
point1_type,
|
||||
typename segment_ratio_type<point1_type, RobustPolicy>::type
|
||||
>
|
||||
> turn_info;
|
||||
|
||||
static const bool reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value;
|
||||
static const bool reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value;
|
||||
|
||||
@@ -200,12 +202,12 @@ struct less_seg_dist_op
|
||||
}
|
||||
|
||||
template <typename Op> static inline
|
||||
bool use_distance(Op const& left, Op const& right)
|
||||
bool use_fraction(Op const& left, Op const& right)
|
||||
{
|
||||
if ( geometry::math::equals(left.enriched.distance, right.enriched.distance) )
|
||||
if ( left.fraction == right.fraction )
|
||||
return use_other_multi_ring_id(left, right);
|
||||
else
|
||||
return left.enriched.distance < right.enriched.distance;
|
||||
return left.fraction < right.fraction;
|
||||
}
|
||||
|
||||
template <typename Turn>
|
||||
@@ -214,7 +216,7 @@ struct less_seg_dist_op
|
||||
segment_identifier const& sl = left.operations[OpId].seg_id;
|
||||
segment_identifier const& sr = right.operations[OpId].seg_id;
|
||||
|
||||
return sl < sr || ( sl == sr && use_distance(left.operations[OpId], right.operations[OpId]) );
|
||||
return sl < sr || ( sl == sr && use_fraction(left.operations[OpId], right.operations[OpId]) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -164,8 +164,8 @@ struct expected_pusher
|
||||
typedef std::vector<std::string>::iterator iterator;
|
||||
typedef std::vector<std::string>::const_iterator const_iterator;
|
||||
|
||||
//iterator begin() { return vec.begin(); }
|
||||
//iterator end() { return vec.end(); }
|
||||
iterator begin() { return vec.begin(); }
|
||||
iterator end() { return vec.end(); }
|
||||
const_iterator begin() const { return vec.begin(); }
|
||||
const_iterator end() const { return vec.end(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user