mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 21:44:04 +00:00
[traverse] revise last weeks fix, make it more general. It should just
skip finalized arcs. This fixes the robustness test almost completely
This commit is contained in:
parent
c9b9c6950f
commit
7d3d0dd69f
@ -263,6 +263,7 @@ struct traversal
|
||||
bool const is_intersection = OperationType == operation_intersection;
|
||||
|
||||
std::size_t selected_rank = 0;
|
||||
std::size_t min_rank = 0;
|
||||
bool result = false;
|
||||
for (std::size_t i = 0; i < sbs.m_ranked_points.size(); i++)
|
||||
{
|
||||
@ -282,8 +283,15 @@ struct traversal
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! is_union && ranked_op.visited.finalized())
|
||||
{
|
||||
// Skip this one, go to next
|
||||
min_rank = ranked_point.main_rank;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ranked_point.index == sort_by_side::index_to
|
||||
&& (ranked_point.main_rank > 0
|
||||
&& (ranked_point.main_rank > min_rank
|
||||
|| ranked_turn.both(operation_continue)))
|
||||
{
|
||||
if ((is_union
|
||||
@ -325,7 +333,6 @@ struct traversal
|
||||
|
||||
inline bool select_turn_from_cluster(signed_size_type& turn_index,
|
||||
int& op_index, signed_size_type start_turn_index,
|
||||
int start_op_index, bool is_start,
|
||||
point_type const& point)
|
||||
{
|
||||
bool const is_union = OperationType == operation_union;
|
||||
@ -341,9 +348,6 @@ struct traversal
|
||||
sbs_type sbs;
|
||||
sbs.set_origin(point);
|
||||
|
||||
bool at_start = false;
|
||||
bool has_finished = false;
|
||||
|
||||
for (typename std::set<signed_size_type>::const_iterator sit = ids.begin();
|
||||
sit != ids.end(); ++sit)
|
||||
{
|
||||
@ -355,30 +359,13 @@ struct traversal
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! is_start && ! is_union && cluster_turn_index == start_turn_index)
|
||||
{
|
||||
at_start = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
sbs.add(cluster_turn.operations[i], cluster_turn_index, i,
|
||||
m_geometry1, m_geometry2, false);
|
||||
|
||||
if (cluster_turn.operations[i].visited.finished())
|
||||
{
|
||||
has_finished = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (at_start && has_finished)
|
||||
{
|
||||
turn_index = start_turn_index;
|
||||
op_index = start_op_index;
|
||||
return true;
|
||||
}
|
||||
|
||||
sbs.apply(turn.point);
|
||||
|
||||
int open_count = 0;
|
||||
@ -530,7 +517,7 @@ struct traversal
|
||||
{
|
||||
|
||||
if (! select_turn_from_cluster(turn_index, op_index,
|
||||
start_turn_index, start_op_index, is_start, current_ring.back()))
|
||||
start_turn_index, current_ring.back()))
|
||||
{
|
||||
return is_start
|
||||
? traverse_error_no_next_ip_at_start
|
||||
|
@ -636,11 +636,25 @@ static std::string case_recursive_boxes_33[2] =
|
||||
|
||||
static std::string case_recursive_boxes_34[2] =
|
||||
{
|
||||
// Requires detecting start turn at cluster and use that to finish it
|
||||
// Requires detecting finished arcs during cluster traversal
|
||||
"MULTIPOLYGON(((2 0,0 0,0 5,2 5,2 4,3 5,5 5,5 0,2 0)))",
|
||||
"MULTIPOLYGON(((3 3,2 3,2 2,3 2,3 1,2 0,1 0,2 1,1 1,1 0,0 0,0 5,1 4,1 5,4 5,3 4,3.5 3.5,4 4,4 5,5 4,5 1,4 1,4 3,3 3)),((3 1,4 1,3 0,3 1)))"
|
||||
};
|
||||
|
||||
static std::string case_recursive_boxes_35[2] =
|
||||
{
|
||||
// Requires detecting finished arcs during cluster traversal
|
||||
"MULTIPOLYGON(((3 1,2 1,3 0,0 0,0 2,1 2,1 3,0 2,0 5,4 5,4 4,5 4,5 1,4 1,5 0,3 0,3 1),(2.5 1.5,3 2,2 2,2.5 1.5),(2 4,1 4,2 3,2 4)))",
|
||||
"MULTIPOLYGON(((2 2,1.5 1.5,2 1,1 1,1 0,0 0,0 5,3 5,2.5 4.5,3 4,3 5,5 5,5 0,1 0,2 1,2 2),(3 2,3 3,2.5 2.5,3 2),(2 3,2 4,1 4,1 3,2 3)))"
|
||||
};
|
||||
|
||||
static std::string case_recursive_boxes_36[2] =
|
||||
{
|
||||
// Requires increasing target rank while skipping finished arcs to avoid duplicate output
|
||||
"MULTIPOLYGON(((5 3,4 3,4 4,5 3)),((5 2,4 2,5 3,5 2)),((5 2,5 1,4 1,5 2)))",
|
||||
"MULTIPOLYGON(((4 2,4 3,5 3,5 2,4 2)),((4 2,4 1,3 1,3 2,4 2)))"
|
||||
};
|
||||
|
||||
static std::string pie_21_7_21_0_3[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,2500 2500)))",
|
||||
|
@ -228,6 +228,12 @@ void test_areal()
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_34",
|
||||
case_recursive_boxes_34[0], case_recursive_boxes_34[1],
|
||||
2, 0, 17.25);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_35",
|
||||
case_recursive_boxes_35[0], case_recursive_boxes_35[1],
|
||||
2, 0, 20.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_36",
|
||||
case_recursive_boxes_36[0], case_recursive_boxes_36[1],
|
||||
1, 0, 0.5);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
|
||||
ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
|
||||
|
@ -218,6 +218,15 @@ void test_areal()
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_33",
|
||||
case_recursive_boxes_33[0], case_recursive_boxes_33[1],
|
||||
1, 0, -1, 11.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_34",
|
||||
case_recursive_boxes_34[0], case_recursive_boxes_34[1],
|
||||
1, 0, -1, 25.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_35",
|
||||
case_recursive_boxes_35[0], case_recursive_boxes_35[1],
|
||||
1, 1, -1, 24.5);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_36",
|
||||
case_recursive_boxes_36[0], case_recursive_boxes_36[1],
|
||||
3, 0, -1, 3.0);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
|
||||
ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
|
||||
|
Loading…
x
Reference in New Issue
Block a user