void triangulateContourSquare(int squareIndex, int contourIndex) {
		PlanarSquare square = planarSquares[squareIndex];
		int edgeMask0 = square.edgeMask12[contourIndex] & 0x00FF;
		if (edgeMask0 == 0) // all outside
			return;

		// unnecessary inside square?
		// full square and next contour is also a full square there
		if (edgeMask0 == 15 && contourIndex + 1 < nContours && square.edgeMask12[contourIndex + 1] == 15)
			return;

		// still working here.... not efficient; stubbornly trying to avoid just
		// writing the damn triangle table.
		boolean isOK = true;
		int edgeMask = edgeMask0;
		if (contourIndex < nContours - 1) {
			edgeMask0 = square.edgeMask12[contourIndex + 1];
			if (edgeMask0 != 0x0F) {
				isOK = false;
				if (((edgeMask ^ edgeMask0) & 0xF0) == 0) {
					isOK = false;
				}
				edgeMask &= 0x0FF;
				edgeMask ^= edgeMask0 & 0x0F0F;
			}
		}
		if (contourIndex > 0 && edgeMask == 0)
			return;
		fillSquare(square, contourIndex, edgeMask, false);
		if (!isOK) // a lazy hack instead of really figuring out the order
			fillSquare(square, contourIndex, edgeMask, true);
	}