code: public static int crossCubic (float x1, float y1, float cx1, float cy1, float cx2,
                                    float cy2, float x2, float y2, float x, float y) {
          // LEFT/RIGHT/UP/EMPTY
          if ((x < x1 && x < cx1 && x < cx2 && x < x2) || (x > x1 && x > cx1 && x > cx2 && x > x2)
                  || (y > y1 && y > cy1 && y > cy2 && y > y2)
                  || (x1 == cx1 && cx1 == cx2 && cx2 == x2)) {
              return 0;
          }
  
          // DOWN
          if (y < y1 && y < cy1 && y < cy2 && y < y2 && x != x1 && x != x2) {
              if (x1 < x2) {
                  return x1 < x && x < x2 ? 1 : 0;
              }
              return x2 < x && x < x1 ? -1 : 0;
          }
  
          // INSIDE
          CubicCurveH c = new CubicCurveH(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
          float px = x - x1, py = y - y1;
          float[] res = new float[3];
          int rc = c.solvePoint(res, px);
          return c.cross(res, rc, py, py);
      }
docs: Returns how many times ray from point (x,y) cross cubic curve