Skip to content

Commit e73f5f1

Browse files
author
Julian
authored
Merge pull request algorithm-archivists#643 from berquist/graham-scan-js
Update Graham Scan in JavaScript to use points from Julia implementation
2 parents d0f926c + 635e093 commit e73f5f1

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

contents/graham_scan/code/javascript/graham-scan.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,23 @@ function ccw(a, b, c) {
3838
}
3939

4040
const points = [
41-
{ x: 1, y: 3 },
42-
{ x: 2, y: 4 },
43-
{ x: 4, y: 0 },
44-
{ x: 1, y: 0 },
45-
{ x: 0, y: 2 },
46-
{ x: 2, y: 2 },
47-
{ x: 3, y: 4 },
48-
{ x: 3, y: 1 },
41+
{ x: -5, y: 2 },
42+
{ x: 5, y: 7 },
43+
{ x: -6, y: -12 },
44+
{ x: -14, y: -14 },
45+
{ x: 9, y: 9 },
46+
{ x: -1, y: -1 },
47+
{ x: -10, y: 11 },
48+
{ x: -6, y: 15 },
49+
{ x: -6, y: -8 },
50+
{ x: 15, y: -9 },
51+
{ x: 7, y: -7 },
52+
{ x: -2, y: -9 },
53+
{ x: 6, y: -5 },
54+
{ x: 0, y: 14 },
55+
{ x: 2, y: 8 },
4956
];
5057

5158
const convexHull = grahamScan(points);
59+
console.log("The points in the hull are:");
5260
convexHull.forEach(p => console.log(`(${p.x}, ${p.y})`));

0 commit comments

Comments
 (0)