I'm having some problem with my program. what I want to implement is a way to understand a point(x,y) in which quadrant is located.
The concept of a quadrant that I'm trying to implement is the following:

I have a rectangle, from which I have the coordinates of all the angles and the edges. given another point in the space, in the 2D space, I would like to know where is located between the top, bottom, left and right.
Thank you in advance.
Okay, So the center, upper left, lower right are: $(c_x, c_y)$, $(ul_x, ul_y)$ and $(lr_x, lr_y)$ and $c_x \approx \frac {ul_x + lr_x}2$ and $c_y\approx \frac {ul_y + lr_y}2$ (give or take a pixel).
We'll let $h = ul_y - lr_y$ and $w = lr_x - ul_x$.
You have two lines. The one going from the lower left hand corner to the upper right hand corner has the equation $(y-c_y) = \frac hw\times (x-c_x)$. We can rewrite this as $y = \frac hw x + (c_y - \frac hwc_x)$. We can further rewrite this as $y = mx + b$ where $m = \frac hw$ and $b = c_y - \frac hwc_x$ if we want.
The other line, top left corner to lower right, has the equation $(y-c_y) = -\frac hw (x-c_x)$ which we can rewrite that as $y = - \frac hw x +(c_y + \frac hwc_x$ or as $y = -mx + d$ where $d = c_y +\frac hwc_x$.
So...
Take a point $(x_0,y_0)$ and do this test.
1) Is $y_0 \ge mx_0 + b$ and $y_0 \ge -mx_0 + d$? If so $(x_0,y_0)$ is in the top quadrant (because $(x_0,y_0)$ is above both the lines).
2) Is $y_0 \ge mx_0 + b$ and $y_0 < -mx_0 + d$? If so $(x_0,y_0)$ is in the left quadrant (because $(x_0,y_0)$ is above [to the left] of the line going up but below [to the left] of the line going down.)
3) Is $y_0 < mx_0 + b$ and $y_0 \ge -mx_0 + d$? If so $(x_0,y_0)$ is in the right quadrant.
4) Is $y_0 < mx_0+ b$ and $y < -mx_0 + d$? If so $(x_0,y_0)$ is in the bottom quadrant.
(this assumes, of course that, the $x$ coordinates go left to right and the $y$ coordinates go down to up. Actually they probably go up to down in which case 1) = bottom; 2) = right; 3)= left and 4) = top.)