code: private static int[] findLeftMostVertex(Contour contour) {
          int minx = contour.verts[0];
          int minz = contour.verts[2];
          int leftmost = 0;
          for (int i = 1; i < contour.nverts; i++) {
              int x = contour.verts[i * 4 + 0];
              int z = contour.verts[i * 4 + 2];
              if (x < minx || (x == minx && z < minz)) {
                  minx = x;
                  minz = z;
                  leftmost = i;
              }
          }
          return new int[] { minx, minz, leftmost };
      }
docs: Finds the lowest leftmost vertex of a contour.