private Point yBinarySearch(Point bottom, Point top) {
        int x = bottom.x; // the same for right and left
        Point mid;
        while (true) {
            if (abs(bottom.y - top.y) == 1) {
                if (abs(bottom.dF) <= abs(top.dF)) {
                    return bottom;
                } else {
                    return top;
                }
            }

            mid = new Point(x,  (top.y + bottom.y) / 2);
            if (mid.dF == 0 || mid.dF == bottom.dF || mid.dF == top.dF) return mid;

            //System.out.println((mid.dF + " : " + left.dF + " :: " + right.dF));
            //System.out.println("left.x : " + left.x + " right x : " + right.x + " x : " + mid.x);
            if (mid.dF * bottom.dF < 0) {
                bottom = mid;
            }
            if (mid.dF * top.dF < 0) {
                top = mid;
            }

        }

    }