Skip to content

Commit 8775c35

Browse files
committed
CLANG format
1 parent 235221c commit 8775c35

File tree

1 file changed

+70
-74
lines changed

1 file changed

+70
-74
lines changed

polygon_coverage_geometry/test/visibility_polygon-test.cpp

Lines changed: 70 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -17,96 +17,92 @@
1717
* this program. If not, see <http://www.gnu.org/licenses/>.
1818
*/
1919

20+
#include "polygon_coverage_geometry/visibility_polygon.h"
21+
22+
#include <CGAL/intersections.h>
2023
#include <CGAL/is_y_monotone_2.h>
2124
#include <gtest/gtest.h>
22-
#include <CGAL/intersections.h>
2325

2426
#include "polygon_coverage_geometry/cgal_comm.h"
2527
#include "polygon_coverage_geometry/test_comm.h"
26-
#include "polygon_coverage_geometry/visibility_polygon.h"
2728

2829
using namespace polygon_coverage_planning;
2930

30-
TEST(VisibilityPolygonTest, computeVisibilityPolygon
31-
) {
32-
PolygonWithHoles rectangle_in_rectangle(
33-
createRectangleInRectangle<Polygon_2, PolygonWithHoles>());
34-
Polygon_2 visibility_polygon;
31+
TEST(VisibilityPolygonTest, computeVisibilityPolygon) {
32+
PolygonWithHoles rectangle_in_rectangle(
33+
createRectangleInRectangle<Polygon_2, PolygonWithHoles>());
34+
Polygon_2 visibility_polygon;
3535

36-
// Query on polygon vertex.
37-
Point_2 query(0.0, 0.0);
38-
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
39-
&visibility_polygon)
40-
);
41-
// Result manually checked.
42-
Line_2 line(Point_2(0, 2), Point_2(2, 2));
43-
Ray_2 ray_1(Point_2(0, 0), Point_2(0.5, 1.75));
44-
Ray_2 ray_2(Point_2(0, 0), Point_2(1.0, 1.25));
45-
auto inter_1 = CGAL::intersection(ray_1, line);
46-
auto inter_2 = CGAL::intersection(ray_2, line);
36+
// Query on polygon vertex.
37+
Point_2 query(0.0, 0.0);
38+
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
39+
&visibility_polygon));
40+
// Result manually checked.
41+
Line_2 line(Point_2(0, 2), Point_2(2, 2));
42+
Ray_2 ray_1(Point_2(0, 0), Point_2(0.5, 1.75));
43+
Ray_2 ray_2(Point_2(0, 0), Point_2(1.0, 1.25));
44+
auto inter_1 = CGAL::intersection(ray_1, line);
45+
auto inter_2 = CGAL::intersection(ray_2, line);
4746

48-
Point_2 points_1[] = {{0.0, 2.0}, {0.0, 0.0}, {2.0, 0.0}, {2.0, 2.0},
49-
*boost::get<Point_2>(&*inter_2), {1.0, 1.25}, {0.5, 1.25},
50-
{0.5, 1.75}, *boost::get<Point_2>(&*inter_1)};
51-
Polygon_2 visibility_polygon_expected_1
52-
(points_1, points_1 + sizeof(points_1) / sizeof(points_1[0]));
53-
EXPECT_EQ(visibility_polygon_expected_1, visibility_polygon
54-
);
47+
Point_2 points_1[] = {{0.0, 2.0},
48+
{0.0, 0.0},
49+
{2.0, 0.0},
50+
{2.0, 2.0},
51+
*boost::get<Point_2>(&*inter_2),
52+
{1.0, 1.25},
53+
{0.5, 1.25},
54+
{0.5, 1.75},
55+
*boost::get<Point_2>(&*inter_1)};
56+
Polygon_2 visibility_polygon_expected_1(
57+
points_1, points_1 + sizeof(points_1) / sizeof(points_1[0]));
58+
EXPECT_EQ(visibility_polygon_expected_1, visibility_polygon);
5559

56-
// Query on hole vertex.
57-
query = Point_2(1.0, 1.25);
58-
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
59-
&visibility_polygon)
60-
);
61-
Point_2 points_2[] = {{0, 0}, {2, 0}, {2, 2}, {1, 2}, {1, 1.25}, {0, 1.25}};
62-
Polygon_2 visibility_polygon_expected_2
63-
(points_2, points_2 + sizeof(points_2) / sizeof(points_2[0]));
64-
EXPECT_EQ(visibility_polygon_expected_2, visibility_polygon
65-
);
60+
// Query on hole vertex.
61+
query = Point_2(1.0, 1.25);
62+
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
63+
&visibility_polygon));
64+
Point_2 points_2[] = {{0, 0}, {2, 0}, {2, 2}, {1, 2}, {1, 1.25}, {0, 1.25}};
65+
Polygon_2 visibility_polygon_expected_2(
66+
points_2, points_2 + sizeof(points_2) / sizeof(points_2[0]));
67+
EXPECT_EQ(visibility_polygon_expected_2, visibility_polygon);
6668

67-
// Query in face.
68-
query = Point_2(1.0, 0.5);
69-
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
70-
&visibility_polygon)
71-
);
72-
// Result manually checked.
73-
Point_2 points_3[] =
74-
{{0, 0}, {2, 0}, {2, 2}, {1, 2}, {1, 1.25}, {0.5, 1.25}, {0, 2}};
75-
Polygon_2 visibility_polygon_expected_3
76-
(points_3, points_3 + sizeof(points_3) / sizeof(points_3[0]));
77-
EXPECT_EQ(visibility_polygon_expected_3, visibility_polygon
78-
);
69+
// Query in face.
70+
query = Point_2(1.0, 0.5);
71+
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
72+
&visibility_polygon));
73+
// Result manually checked.
74+
Point_2 points_3[] = {{0, 0}, {2, 0}, {2, 2}, {1, 2},
75+
{1, 1.25}, {0.5, 1.25}, {0, 2}};
76+
Polygon_2 visibility_polygon_expected_3(
77+
points_3, points_3 + sizeof(points_3) / sizeof(points_3[0]));
78+
EXPECT_EQ(visibility_polygon_expected_3, visibility_polygon);
7979

80-
// Query on polygon halfedge.
81-
query = Point_2(1.0, 0.0);
82-
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
83-
&visibility_polygon)
84-
);
85-
// Result manually checked.
86-
Ray_2 ray_3(Point_2(1, 0), Point_2(0.5, 1.25));
87-
auto inter_3 = CGAL::intersection(ray_3, line);
88-
Point_2 points_4[] =
89-
{{0, 2}, {0, 0}, {2, 0}, {2, 2}, {1, 2}, {1, 1.25}, {0.5, 1.25},
90-
*boost::get<Point_2>(&*inter_3)};
91-
Polygon_2 visibility_polygon_expected_4
92-
(points_4, points_4 + sizeof(points_4) / sizeof(points_4[0]));
93-
EXPECT_EQ(visibility_polygon_expected_4, visibility_polygon
94-
);
80+
// Query on polygon halfedge.
81+
query = Point_2(1.0, 0.0);
82+
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
83+
&visibility_polygon));
84+
// Result manually checked.
85+
Ray_2 ray_3(Point_2(1, 0), Point_2(0.5, 1.25));
86+
auto inter_3 = CGAL::intersection(ray_3, line);
87+
Point_2 points_4[] = {
88+
{0, 2}, {0, 0}, {2, 0}, {2, 2},
89+
{1, 2}, {1, 1.25}, {0.5, 1.25}, *boost::get<Point_2>(&*inter_3)};
90+
Polygon_2 visibility_polygon_expected_4(
91+
points_4, points_4 + sizeof(points_4) / sizeof(points_4[0]));
92+
EXPECT_EQ(visibility_polygon_expected_4, visibility_polygon);
9593

96-
// Query on hole halfedge.
97-
query = Point_2(0.75, 1.25);
98-
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
99-
&visibility_polygon)
100-
);
101-
// Result manually checked.
102-
Point_2 points_5[] = {{2, 1.25}, {0, 1.25}, {0, 0}, {2, 0}};
103-
Polygon_2 visibility_polygon_expected_5
104-
(points_5, points_5 + sizeof(points_5) / sizeof(points_5[0]));
105-
EXPECT_EQ(visibility_polygon_expected_5, visibility_polygon
106-
);
94+
// Query on hole halfedge.
95+
query = Point_2(0.75, 1.25);
96+
EXPECT_TRUE(computeVisibilityPolygon(rectangle_in_rectangle, query,
97+
&visibility_polygon));
98+
// Result manually checked.
99+
Point_2 points_5[] = {{2, 1.25}, {0, 1.25}, {0, 0}, {2, 0}};
100+
Polygon_2 visibility_polygon_expected_5(
101+
points_5, points_5 + sizeof(points_5) / sizeof(points_5[0]));
102+
EXPECT_EQ(visibility_polygon_expected_5, visibility_polygon);
107103
}
108104

109-
int main(int argc, char **argv) {
105+
int main(int argc, char** argv) {
110106
testing::InitGoogleTest(&argc, argv);
111107
return RUN_ALL_TESTS();
112108
}

0 commit comments

Comments
 (0)