44 #include <visp3/core/vpConfig.h>
45 #include <visp3/core/vpImagePoint.h>
47 #if defined(VISP_HAVE_CATCH2)
48 #define CATCH_CONFIG_RUNNER
51 TEST_CASE(
"Test comparison operator",
"[operator]")
64 CHECK_FALSE(ip1 != ip2);
65 CHECK_FALSE(ip1 == ip3);
69 TEST_CASE(
"Test pixel belongs to segment",
"[operator]")
72 SECTION(
"Segment horizontal right")
75 auto j = start_pixel.get_j();
76 for (
auto curr_pixel = start_pixel; curr_pixel.inSegment(start_pixel, end_pixel);
77 curr_pixel = curr_pixel.nextInSegment(start_pixel, end_pixel), j++) {
78 CHECK(curr_pixel ==
vpImagePoint(start_pixel.get_i(), j));
79 if (curr_pixel == end_pixel)
83 SECTION(
"Segment horizontal left")
86 auto j = start_pixel.get_j();
87 for (
auto curr_pixel = start_pixel; curr_pixel.inSegment(start_pixel, end_pixel);
88 curr_pixel = curr_pixel.nextInSegment(start_pixel, end_pixel), j--) {
89 CHECK(curr_pixel ==
vpImagePoint(start_pixel.get_i(), j));
90 if (curr_pixel == end_pixel)
94 SECTION(
"Segment vertical bottom")
97 auto i = start_pixel.get_i();
98 for (
auto curr_pixel = start_pixel; curr_pixel.inSegment(start_pixel, end_pixel);
99 curr_pixel = curr_pixel.nextInSegment(start_pixel, end_pixel), i++) {
100 CHECK(curr_pixel ==
vpImagePoint(i, start_pixel.get_j()));
101 if (curr_pixel == end_pixel)
105 SECTION(
"Segment vertical top")
108 auto i = start_pixel.get_i();
109 for (
auto curr_pixel = start_pixel; curr_pixel.inSegment(start_pixel, end_pixel);
110 curr_pixel = curr_pixel.nextInSegment(start_pixel, end_pixel), i--) {
111 CHECK(curr_pixel ==
vpImagePoint(i, start_pixel.get_j()));
112 if (curr_pixel == end_pixel)
118 int main(
int argc,
char *argv[])
120 Catch::Session session;
123 session.applyCommandLine(argc, argv);
125 int numFailed = session.run();
147 std::cout <<
"We define ip1 with coordinates: " << ip1 << std::endl;
149 std::cout <<
"We define ip2 with coordinates: " << ip2 << std::endl;
151 std::cout <<
"We define ip3 with coordinates: " << ip3 << std::endl;
154 std::cout <<
"ip1 == ip2" << std::endl;
156 std::cout <<
"ip1 != ip2 (bad result)" << std::endl;
161 std::cout <<
"ip1 != ip2 (bad result)" << std::endl;
164 std::cout <<
"ip1 == ip2" << std::endl;
168 std::cout <<
"ip1 == ip3 (bad result)" << std::endl;
171 std::cout <<
"ip1 != ip3" << std::endl;
175 std::cout <<
"ip1 != ip3" << std::endl;
177 std::cout <<
"ip1 == ip3 (bad result)" << std::endl;
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...