Skip to content

Commit d6c0204

Browse files
berquistc252
authored andcommitted
Update Graham Scan in C to use points from Julia implementation (algorithm-archivists#642)
1 parent 1ed4dce commit d6c0204

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

contents/graham_scan/code/c/graham.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,17 @@ size_t graham_scan(struct point *points, size_t size) {
9595
}
9696

9797
int main() {
98-
struct point points[] = {{2.0, 1.9}, {1.0, 1.0}, {2.0, 4.0}, {3.0, 1.0},
99-
{2.0, 0.0}};
98+
struct point points[] = {{-5, 2}, {5, 7}, {-6, -12}, {-14, -14}, {9, 9},
99+
{-1, -1}, {-10, 11}, {-6, 15}, {-6, -8}, {15, -9},
100+
{7, -7}, {-2, -9}, {6, -5}, {0, 14}, {2, 8}};
101+
size_t num_initial_points = 15;
100102

101103
printf("Points:\n");
102-
for (size_t i = 0; i < 5; ++i) {
104+
for (size_t i = 0; i < num_initial_points; ++i) {
103105
printf("(%f,%f)\n", points[i].x, points[i].y);
104106
}
105107

106-
size_t hull_size = graham_scan(points, 5);
108+
size_t hull_size = graham_scan(points, num_initial_points);
107109

108110
printf("\nHull:\n");
109111
for (size_t i = 0; i < hull_size; ++i) {

0 commit comments

Comments
 (0)