private void calculateNextIndices() {
		Integer[] nextArr = new Integer[v.size()];
		Integer target = 0;
		Integer startIndex = target;
		Set<Integer> usedIndices = new HashSet<>();
		while (notAllFilled(nextArr)) {
			Integer nextIndex = null;
			Edge curEdge = new Edge(points.get(v.get(startIndex)), points.get(v.get(o.get(startIndex))));
			Set<Integer> possibleNextIndices = new HashSet<>();
			for (int i = 0; i < v.size(); i++) {
				if (v.get(i).equals(v.get(o.get(startIndex))) && !usedIndices.contains(i)) {
					possibleNextIndices.add(i);
				}
			}
			double minAngle = Double.MAX_VALUE;
			for (Integer j : possibleNextIndices) {
				Vector v1 = curEdge.asVec().normalize();
				Vector v2 = new Edge(points.get(v.get(j)), points.get(v.get(o.get(j)))).asVec().normalize();
				double angleBetween = v1.angleBetween(v2);
				if (angleBetween < minAngle) {
					minAngle = angleBetween;
					nextIndex = j;
				}
			}

			nextArr[startIndex] = nextIndex;
			usedIndices.add(nextIndex);
			startIndex = nextIndex;

			if (nextIndex.equals(target)) {
				for (int i = 0; i < nextArr.length; i++) {
					if (nextArr[i] != null) continue;
					startIndex = i;
					target = startIndex;
					break;
				}
			}

		}

		n = Arrays.asList(nextArr);
	}