Skip to content

Commit fbf09cf

Browse files
committed
Add ConvexHullTest.java for convex hull algorithm testing
1 parent b316dcf commit fbf09cf

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.thealgorithms.geometry;
2+
3+
import java.util.*;
4+
5+
public class ConvexHullTest {
6+
public static void main(String[] args) {
7+
List<Point> points = Arrays.asList(
8+
new Point(0, 3),
9+
new Point(2, 2),
10+
new Point(1, 1),
11+
new Point(2, 1),
12+
new Point(3, 0),
13+
new Point(0, 0),
14+
new Point(3, 3)
15+
);
16+
17+
System.out.println("Input Points:");
18+
for (Point p : points) System.out.print(p + " ");
19+
System.out.println();
20+
21+
List<Point> hullBruteForce = ConvexHull.convexHullBruteForce(points);
22+
System.out.println("\nConvex Hull (Brute Force):");
23+
for (Point p : hullBruteForce) System.out.print(p + " ");
24+
System.out.println();
25+
26+
List<Point> hullRecursive = ConvexHull.convexHullRecursive(points);
27+
System.out.println("\nConvex Hull (Recursive):");
28+
for (Point p : hullRecursive) System.out.print(p + " ");
29+
System.out.println();
30+
}
31+
}

0 commit comments

Comments
 (0)