BitSet[] getSurfaceSet(int level) {
		if (currentMesh == null)
			return null;
		if (level == 0) {
			surfaceSet = new BitSet[100];
			nSets = 0;
		}
		setsSuccessful = true;
		for (int i = 0; i < currentMesh.polygonCount; i++) {
			int[] p = currentMesh.polygonIndexes[i];
			int pt0 = findSet(p[0]);
			int pt1 = findSet(p[1]);
			int pt2 = findSet(p[2]);
			if (pt0 < 0 && pt1 < 0 && pt2 < 0) {
				createSet(p[0], p[1], p[2]);
				continue;
			}
			if (pt0 == pt1)
				continue;
			if (pt0 >= 0) {
				surfaceSet[pt0].set(p[1]);
				surfaceSet[pt0].set(p[2]);
				if (pt1 >= 0 && pt1 != pt0)
					mergeSets(pt0, pt1);
				if (pt2 >= 0 && pt2 != pt0 && pt2 != pt1)
					mergeSets(pt0, pt2);
				continue;
			}
			if (pt1 >= 0) {
				surfaceSet[pt1].set(p[0]);
				surfaceSet[pt1].set(p[2]);
				if (pt2 >= 0 && pt2 != pt1)
					mergeSets(pt1, pt2);
				continue;
			}
			surfaceSet[pt2].set(p[0]);
			surfaceSet[pt2].set(p[1]);
		}
		int n = 0;
		for (int i = 0; i < nSets; i++)
			if (surfaceSet[i] != null)
				n++;
		BitSet[] temp = new BitSet[n];
		n = 0;
		for (int i = 0; i < nSets; i++)
			if (surfaceSet[i] != null)
				temp[n++] = surfaceSet[i];
		nSets = n;
		surfaceSet = temp;
		if (!setsSuccessful && level < 2)
			getSurfaceSet(++level);
		return surfaceSet;
	}