Skip to content

Commit 574c85f

Browse files
authored
Merge pull request #706 from berquist/jarvis-march-c++-points
Update C++ Jarvis March to use points from Graham Scan
2 parents 9ac39ef + 944d7eb commit 574c85f

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

contents/jarvis_march/code/c++/jarvis_march.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,21 @@ std::vector<Point> jarvis_march(const std::vector<Point>& points)
5050

5151
int main() {
5252
std::vector<Point> points = {
53-
{ 1.0, 3.0 },
54-
{ 1.0, 3.0 },
55-
{ 2.0, 4.0 },
56-
{ 4.0, 0.0 },
57-
{ 1.0, 0.0 },
58-
{ 0.0, 2.0 },
59-
{ 2.0, 2.0 },
60-
{ 3.0, 4.0 },
61-
{ 3.0, 1.0 },
53+
{ -5.0, 2.0 },
54+
{ 5.0, 7.0 },
55+
{ -6.0, -12.0 },
56+
{ -14.0, -14.0 },
57+
{ 9.0, 9.0 },
58+
{ -1.0, -1.0 },
59+
{ -10.0, 11.0 },
60+
{ -6.0, 15.0 },
61+
{ -6.0, -8.0 },
62+
{ 15.0, -9.0 },
63+
{ 7.0, -7.0 },
64+
{ -2.0, -9.0 },
65+
{ 6.0, -5.0 },
66+
{ 0.0, 14.0 },
67+
{ 2.0, 8.0 }
6268
};
6369

6470
auto hull_points = jarvis_march(points);
@@ -69,4 +75,3 @@ int main() {
6975
std::cout << '(' << point.x << ", " << point.y << ')' << std::endl;
7076
}
7177
}
72-

0 commit comments

Comments
 (0)