public static Point[] convex_hull(Point[] points) {
		int n = points.length;

		Point minimin = null;
		for (int i = 0; i < n; i++) {
			if (minimin == null || points[i].compareTo(minimin) == -1) {
				minimin = points[i];
			}
		}

		root = minimin;

		Arrays.sort(points, new CounterClockwiseComparator());

		int j;

		Point[] convex_hull = new Point[n];
		j = 0;
		for (int i = 0; i < n; i++) {
			while (i > 1 && j > 1 && turn(points[i], convex_hull[j - 1], convex_hull[j - 2]) >= 0) {
				j--;
			}
			convex_hull[j++] = points[i];
		}
		return Arrays.copyOf(convex_hull, j);

	}