Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
b42c00c9
Commit
b42c00c9
authored
Jan 28, 2018
by
LEFEBVREJP email
Browse files
#14
. Finished testing of 4 edge group case.
parent
82f7edc5
Pipeline
#11529
passed with stages
in 4 minutes and 34 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixalgorithm/marchingsquares.i.hh
View file @
b42c00c9
...
...
@@ -128,6 +128,8 @@ std::vector<std::pair<int, int>> MarchingSquares<data_type>::march(
mData
[
i
]
=
wash_bit
;
}
}
//
// TODO: Simply polygon being returned with Ramer-Douglas-Peuker algorithm
return
out
;
}
// march
...
...
radixalgorithm/tests/tstMarchingSquares.cc
View file @
b42c00c9
...
...
@@ -141,25 +141,110 @@ TEST(MarchingSquares, 4EdgeGroups)
{
std
::
vector
<
std
::
pair
<
int
,
int
>>
contour
=
ms
.
march
(
2.
,
0.
,
3.
);
ms
.
dump_component_map
(
std
::
cout
);
std
::
cout
<<
"{"
<<
std
::
endl
;
for
(
size_t
i
=
0
;
i
<
contour
.
size
();
++
i
)
// ms.dump_component_map(std::cout);
// std::cout << "{" << std::endl;
// for (size_t i = 0; i < contour.size(); ++i)
// {
// const auto& pixel = contour[i];
// std::cout << "{" << pixel.first << "," << pixel.second << "}";
// if (i != contour.size() - 1)
// {
// std::cout << ",";
// }
// std::cout << std::endl;
// }
// std::cout << "}" << std::endl;
std
::
vector
<
std
::
pair
<
int
,
int
>>
blessed
{
{
2
,
0
},
{
3
,
0
},
{
4
,
0
},
{
5
,
0
},
{
6
,
0
},
{
7
,
0
},
{
8
,
0
},
{
8
,
1
},
{
8
,
2
},
{
7
,
2
},
{
6
,
2
},
{
5
,
2
},
{
4
,
2
},
{
3
,
2
},
{
2
,
2
},
{
2
,
1
}};
ASSERT_EQ
(
blessed
.
size
(),
contour
.
size
());
for
(
size_t
i
=
0
;
i
<
blessed
.
size
();
++
i
)
{
EXPECT_EQ
(
blessed
[
i
],
contour
[
i
]);
}
// Expect there to be no more contours between 2 and 3
EXPECT_EQ
(
0
,
ms
.
march
(
2.
,
0.
,
3.
).
size
());
}
{
std
::
vector
<
std
::
pair
<
int
,
int
>>
contour
=
ms
.
march
(
3.
,
0.
,
4.
);
// ms.dump_component_map(std::cout);
// std::cout << "{" << std::endl;
// for (size_t i = 0; i < contour.size(); ++i)
// {
// const auto& pixel = contour[i];
// std::cout << "{" << pixel.first << "," << pixel.second << "}";
// if (i != contour.size() - 1)
// {
// std::cout << ",";
// }
// std::cout << std::endl;
// }
// std::cout << "}" << std::endl;
std
::
vector
<
std
::
pair
<
int
,
int
>>
blessed
{{
6
,
6
},
{
7
,
6
},
{
8
,
6
},
{
9
,
6
},
{
9
,
5
},
{
9
,
4
},
{
9
,
3
},
{
9
,
8
},
{
8
,
8
},
{
7
,
8
},
{
6
,
8
},
{
6
,
7
}};
ASSERT_EQ
(
blessed
.
size
(),
contour
.
size
());
for
(
size_t
i
=
0
;
i
<
blessed
.
size
();
++
i
)
{
const
auto
&
pixel
=
contour
[
i
];
std
::
cout
<<
"{"
<<
pixel
.
first
<<
","
<<
pixel
.
second
<<
"}"
;
if
(
i
!=
contour
.
size
()
-
1
)
{
std
::
cout
<<
","
;
}
std
::
cout
<<
std
::
endl
;
EXPECT_EQ
(
blessed
[
i
],
contour
[
i
]);
}
std
::
cout
<<
"}"
<<
std
::
endl
;
std
::
vector
<
std
::
pair
<
int
,
int
>>
blessed
;
// Expect there to be no more contours between 3 and 4
EXPECT_EQ
(
0
,
ms
.
march
(
3.
,
0.
,
4.
).
size
());
}
{
std
::
vector
<
std
::
pair
<
int
,
int
>>
contour
=
ms
.
march
(
4.
,
0.
,
5.
);
// ms.dump_component_map(std::cout);
// std::cout << "{" << std::endl;
// for (size_t i = 0; i < contour.size(); ++i)
// {
// const auto& pixel = contour[i];
// std::cout << "{" << pixel.first << "," << pixel.second << "}";
// if (i != contour.size() - 1)
// {
// std::cout << ",";
// }
// std::cout << std::endl;
// }
// std::cout << "}" << std::endl;
std
::
vector
<
std
::
pair
<
int
,
int
>>
blessed
{
{
4
,
18
},
{
5
,
18
},
{
5
,
17
},
{
6
,
17
},
{
7
,
17
},
{
8
,
17
},
{
8
,
18
},
{
9
,
18
},
{
9
,
19
},
{
8
,
19
},
{
7
,
19
},
{
6
,
19
},
{
4
,
19
}};
ASSERT_EQ
(
blessed
.
size
(),
contour
.
size
());
for
(
size_t
i
=
0
;
i
<
blessed
.
size
();
++
i
)
{
EXPECT_EQ
(
blessed
[
i
],
contour
[
i
]);
}
// Expect there to be no more contours between 4 and 5
EXPECT_EQ
(
0
,
ms
.
march
(
4.
,
0.
,
5.
).
size
());
}
{
std
::
vector
<
std
::
pair
<
int
,
int
>>
contour
=
ms
.
march
(
5.
);
// ms.dump_component_map(std::cout);
// std::cout << "{" << std::endl;
// for (size_t i = 0; i < contour.size(); ++i)
// {
// const auto& pixel = contour[i];
// std::cout << "{" << pixel.first << "," << pixel.second << "}";
// if (i != contour.size() - 1)
// {
// std::cout << ",";
// }
// std::cout << std::endl;
// }
// std::cout << "}" << std::endl;
std
::
vector
<
std
::
pair
<
int
,
int
>>
blessed
{{
0
,
14
},
{
1
,
14
},
{
2
,
14
},
{
2
,
15
},
{
2
,
16
},
{
2
,
17
},
{
1
,
17
},
{
0
,
17
},
{
0
,
16
},
{
0
,
15
}};
//
ASSERT_EQ(blessed.size(), contour.size());
ASSERT_EQ
(
blessed
.
size
(),
contour
.
size
());
for
(
size_t
i
=
0
;
i
<
blessed
.
size
();
++
i
)
{
EXPECT_EQ
(
blessed
[
i
],
contour
[
i
]);
}
// Expect there to be no more contours greater than 5
EXPECT_EQ
(
0
,
ms
.
march
(
5.
).
size
());
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment