mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
[traverse] fix certain cases to recognize starting point during intersection
in a broader context
This commit is contained in:
parent
c4ab3653eb
commit
efecc02866
@ -702,24 +702,29 @@ struct traversal
|
||||
{
|
||||
turn_type const& current_turn = m_turns[turn_index];
|
||||
|
||||
if (target_operation == operation_intersection
|
||||
&& current_turn.both(operation_intersection)
|
||||
&& turn_index == start_turn_index)
|
||||
if (target_operation == operation_intersection)
|
||||
{
|
||||
// Intersection can always be finished if returning at ii
|
||||
op_index = start_op_index;
|
||||
return true;
|
||||
}
|
||||
bool const back_at_start_cluster
|
||||
= current_turn.cluster_id >= 0
|
||||
&& m_turns[start_turn_index].cluster_id == current_turn.cluster_id;
|
||||
|
||||
if (current_turn.cluster_id < 0
|
||||
&& target_operation == operation_intersection
|
||||
&& current_turn.both(operation_intersection))
|
||||
{
|
||||
if (analyze_ii_intersection(turn_index, op_index, current_turn,
|
||||
previous_seg_id))
|
||||
if (turn_index == start_turn_index || back_at_start_cluster)
|
||||
{
|
||||
// Intersection can always be finished if returning
|
||||
turn_index = start_turn_index;
|
||||
op_index = start_op_index;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (current_turn.cluster_id < 0
|
||||
&& current_turn.both(operation_intersection))
|
||||
{
|
||||
if (analyze_ii_intersection(turn_index, op_index, current_turn,
|
||||
previous_seg_id))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (current_turn.cluster_id >= 0)
|
||||
|
@ -821,6 +821,13 @@ static std::string case_recursive_boxes_38[2] =
|
||||
"MULTIPOLYGON(((2 2,4 2,4 1,2 1,2 2)),((0 4,0 5,1 4,0 4)),((2 3,2 4,4 4,4 3,2 3)),((2 2,1 2,1 3,2 3,2 2)),((1 2,0 2,0 3,1 3,0.5 2.5,1 2)))"
|
||||
};
|
||||
|
||||
static std::string case_recursive_boxes_39[2] =
|
||||
{
|
||||
// Needs check for back at start during traversal
|
||||
"MULTIPOLYGON(((3 8,2 8,2 9,3 9,3 8)),((4 8,4 9,5 9,5 8,4 8)),((6 9,6 10,7 10,7 9,6 9)),((5 6,4 6,4 7,6 7,6 5,5 5,5 6)),((4 7,3 7,3 8,4 8,4 7)),((7 8,8 8,8 7,6 7,6 8,7 8)))",
|
||||
"MULTIPOLYGON(((3 7,3 6,2 6,2 7,3 7)),((4 8,4 7,3 7,3 8,4 8)),((6 10,7 10,7 9,5 9,5 10,6 10)),((5 8,4 8,4 9,5 9,5 8)),((5 8,6 8,6 7,5 7,5 8)))"
|
||||
};
|
||||
|
||||
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)))",
|
||||
|
@ -146,9 +146,11 @@ void test_areal()
|
||||
TEST_INTERSECTION(case_124_multi, 2, 13, 2.0625);
|
||||
TEST_INTERSECTION_IGNORE(case_125_multi, 3, 17, 2.1);
|
||||
|
||||
// #1 needs self-turns to make valid
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",
|
||||
case_recursive_boxes_1[0], case_recursive_boxes_1[1],
|
||||
8, 97, 47.0, ignore_validity);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
|
||||
case_recursive_boxes_2[0], case_recursive_boxes_2[1],
|
||||
1, 50, 90.0); // Area from SQL Server
|
||||
@ -264,6 +266,8 @@ void test_areal()
|
||||
case_recursive_boxes_37[0], case_recursive_boxes_37[1],
|
||||
2, 0, 1.0);
|
||||
|
||||
TEST_INTERSECTION(case_recursive_boxes_39, 3, 0, 3.00);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
|
||||
ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
|
||||
2, 10, 6.0); // Area from SQL Server
|
||||
|
Loading…
x
Reference in New Issue
Block a user