Skip to content

Commit 49c0a83

Browse files
reverted GrahamScan.java
1 parent 9eb7a95 commit 49c0a83

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

src/main/java/com/thealgorithms/geometry/GrahamScan.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@ public class GrahamScan {
1919
private final Stack<Point> hull = new Stack<>();
2020

2121
public GrahamScan(Point[] points) {
22-
// Validate input data
23-
if (points == null || points.length < 3) {
24-
throw new IllegalArgumentException("At least 3 points are required to compute the convex hull");
25-
}
26-
// Check if all points are the same
27-
boolean allSame = true;
28-
for (int i = 1; i < points.length; i++) {
29-
if (!points[i].equals(points[0])) {
30-
allSame = false;
31-
break;
32-
}
33-
}
34-
if (allSame) {
35-
hull.push(points[0]);
36-
return;
37-
}
3822
// Pre-process points: sort by y-coordinate, then by polar order with respect to the first point
3923
Arrays.sort(points);
4024
Arrays.sort(points, 1, points.length, points[0].polarOrder());

0 commit comments

Comments
 (0)