code: protected static int crossBound (double[] bound, int bc, double py1, double py2) {
          // LEFT/RIGHT
          if (bc == 0) {
              return 0;
          }
  
          // Check Y coordinate
          int up = 0;
          int down = 0;
          for (int i = 2; i < bc; i += 4) {
              if (bound[i] < py1) {
                  up++;
                  continue;
              }
              if (bound[i] > py2) {
                  down++;
                  continue;
              }
              return CROSSING;
          }
  
          // UP
          if (down == 0) {
              return 0;
          }
  
          if (up != 0) {
              // bc >= 2
              sortBound(bound, bc);
              boolean sign = bound[2] > py2;
              for (int i = 6; i < bc; i += 4) {
                  boolean sign2 = bound[i] > py2;
                  if (sign != sign2 && bound[i + 1] != bound[i - 3]) {
                      return CROSSING;
                  }
                  sign = sign2;
              }
          }
          return UNKNOWN;
      }
docs: Returns whether bounds intersect a rectangle or not.