private static Line[] handleGeneralCase(ArrayList<Point> convexHull) {
		Line[] minRectangle = new Line[4];
		Line[] currentRectangle = new Line[4];
		int[] hullIndices = { 0, findMin(true, convexHull), findMax(false, convexHull), findMax(true, convexHull) };
		int size = convexHull.size();
		double minArea;
		double totalAngle = 0;

		//initialize
		minRectangle[0] = new Line(convexHull.get(hullIndices[0]), new Vector(1, 0)); // lower horizontal line
		minRectangle[1] = new Line(convexHull.get(hullIndices[1]), new Vector(0, -1)); // left vertical line
		minRectangle[2] = new Line(convexHull.get(hullIndices[2]), new Vector(-1, 0)); // top horizontal line
		minRectangle[3] = new Line(convexHull.get(hullIndices[3]), new Vector(0, 1)); // right vertical line
		minArea = Line.calculateRectangleArea(minRectangle);

		// copy
		for (int i = 0; i < 4; i++)
			currentRectangle[i] = new Line(minRectangle[i]);

		//find minimum
		while (totalAngle < Math.PI / 2) {
			// find line with smallest turning angle
			double smallestAngle = Double.MAX_VALUE;
			int index = 0;
			for (int i = 0; i < 4; i++) {
				int nextIndex = (hullIndices[i] + 1) % size;
				double currentAngle = currentRectangle[i].calculateAngle(convexHull.get(nextIndex));

				if (Math.abs(smallestAngle) > Math.abs(currentAngle)) {
					smallestAngle = currentAngle;
					index = i;
				}
			}

			// turn smallest line
			hullIndices[index] = (hullIndices[index] + 1) % size;
			currentRectangle[index].rotateLine(convexHull.get(hullIndices[index]));

			// turn other lines
			for (int i = 0; i < 4; i++) {
				if (i != index)
					currentRectangle[i].rotateLine(smallestAngle);
			}

			totalAngle += Math.abs(smallestAngle);
			double currentArea = Line.calculateRectangleArea(currentRectangle);

			if (currentArea < minArea) {
				minArea = currentArea;

				// copy to minimum
				for (int i = 0; i < 4; i++)
					minRectangle[i] = new Line(currentRectangle[i]);
			}
		}

		for (int i = 0; i < minRectangle.length; i++) {
			System.out.println(minRectangle[i].toString());
		}

		return minRectangle;
	}