forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConvexHullTest.java
More file actions
31 lines (26 loc) · 997 Bytes
/
ConvexHullTest.java
File metadata and controls
31 lines (26 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.thealgorithms.geometry;
import java.util.*;
public class ConvexHullTest {
public static void main(String[] args) {
List<Point> points = Arrays.asList(
new Point(0, 3),
new Point(2, 2),
new Point(1, 1),
new Point(2, 1),
new Point(3, 0),
new Point(0, 0),
new Point(3, 3)
);
System.out.println("Input Points:");
for (Point p : points) System.out.print(p + " ");
System.out.println();
List<Point> hullBruteForce = ConvexHull.convexHullBruteForce(points);
System.out.println("\nConvex Hull (Brute Force):");
for (Point p : hullBruteForce) System.out.print(p + " ");
System.out.println();
List<Point> hullRecursive = ConvexHull.convexHullRecursive(points);
System.out.println("\nConvex Hull (Recursive):");
for (Point p : hullRecursive) System.out.print(p + " ");
System.out.println();
}
}